This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Code generated by MockGen. DO NOT EDIT. | |
| // Source: gomocking/repository (interfaces: DatabaseInterface) | |
| // Package mocks is a generated GoMock package. | |
| package mocks | |
| import ( | |
| gomock "github.com/golang/mock/gomock" | |
| reflect "reflect" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package repository | |
| import ( | |
| "fmt" | |
| ) | |
| type Database struct {} | |
| func New(db Database) Database { | |
| return db |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package repository | |
| type DatabaseInterface interface { | |
| Insert(number int) error | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package usecase | |
| import ( | |
| "errors" | |
| "gomocking/mocks" | |
| "gomocking/repository" | |
| "testing" | |
| "github.com/golang/mock/gomock" | |
| "github.com/undefinedlabs/go-mpatch" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package usecase | |
| import ( | |
| "errors" | |
| "gomocking/repository" | |
| "strconv" | |
| ) | |
| type Usecase struct { | |
| Database repository.DatabaseInterface |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| uc "gomocking/usecase" | |
| db "gomocking/database" | |
| ) | |
| func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSERT INTO person | |
| (name, country, job, age) | |
| values ('Mike', 'England', 'Software Engineer', 30) | |
| ON CONFLICT ON CONSTRAINT person_name_country_unique | |
| DO NOTHING; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ALTER TABLE person | |
| ADD CONSTRAINT person_name_country_unique UNIQUE ("name", country); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSERT INTO person | |
| (name, country, job, age) | |
| values ('Mike', 'England', 'Software Engineer', 5) | |
| ON CONFLICT (name) | |
| DO UPDATE SET age = person.age + EXCLUDED.age; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSERT INTO person | |
| (name, country, job, age) | |
| values ('Peter', 'Egypt', 'Engineering Manager', 32) | |
| ON CONFLICT (name) | |
| DO UPDATE SET job = EXCLUDED.job || ',' || person.job; |
NewerOlder