[FEATURE REQUEST] Common ORM queries
LdDl opened this issue · comments
Is your feature request related to a problem? Please describe.
Consider to make automatic code generation for such ORM queries as:
- Select all
- Select by PK
- Delete by PK
- Update by PK
Describe the solution you'd like and provide pseudocode examples if you can
Do it in same manner as main functionality is done (use of text/template
).
E.g. Select
:
const tmpSelect = `
func (dbConn *{{ .DataBase }}) Select{{ .StructName }}() ([]*{{ .StructName }}, error) {
ctx := context.Background()
model := []*{{ .StructName }}{}
err := dbConn.NewSelect().
Model(&model).
Scan(ctx)
return model, err
}`
Additional context
Prepare new branch(-es) and do some testing stuff in it
Base SELECT
queries a.k.a. select * from t
are done