Skip to content

Instantly share code, notes, and snippets.

@patrickmscott
Created November 2, 2018 13:06
Show Gist options
  • Save patrickmscott/a6d395302490d3be92446b4225381c65 to your computer and use it in GitHub Desktop.
Save patrickmscott/a6d395302490d3be92446b4225381c65 to your computer and use it in GitHub Desktop.
Model interface proposal
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