Created
November 2, 2018 13:06
-
-
Save patrickmscott/a6d395302490d3be92446b4225381c65 to your computer and use it in GitHub Desktop.
Model interface proposal
This file contains 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
type PayrollModel interface { | |
Get(context.Context) (*Payroll, error) | |
} | |
func NewPayrollModel(dbx db.SQLExecutor) PayrollModel { | |
return &payrollModelImpl{db: db} | |
} | |
type payrollModelImpl struct { | |
db db.SQLExecutor | |
} | |
func (impl *payrollModelImpl) Get(ctx context.Context) (*Payroll, error) { | |
impl.db.Select(...).Where(...).ScanStruct(&payroll) | |
// etc. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment