WIP
This commit is contained in:
14
gen.go.tmpl
14
gen.go.tmpl
@@ -29,13 +29,13 @@ const {{.LowerType}}_SelectQuery = "{{.SelectQuery}}"
|
||||
func {{.LowerType}}_Insert(
|
||||
tx dbConn,
|
||||
row {{.Type}},
|
||||
) (row {{.Type}}, err error) {
|
||||
) ({{.Type}}, error) {
|
||||
row = {{.LowerType}}_Sanitize(row)
|
||||
if err = {{.LowerType}}_Validate(row); err != nil {
|
||||
if err := {{.LowerType}}_Validate(row); err != nil {
|
||||
return row, err
|
||||
}
|
||||
|
||||
_, err = tx.Exec("{{.InsertQuery}}", {{.InsertArgs}})
|
||||
_, err := tx.Exec("{{.InsertQuery}}", {{.InsertArgs}})
|
||||
return row, err
|
||||
}
|
||||
|
||||
@@ -48,9 +48,9 @@ func {{.LowerType}}_Insert(
|
||||
func {{.LowerType}}_Update(
|
||||
tx dbConn,
|
||||
row {{.Type}},
|
||||
) (row {{.Type}}, err error) {
|
||||
) ({{.Type}}, error) {
|
||||
row = {{.LowerType}}_Sanitize(row)
|
||||
if err = {{.LowerType}}_Validate(row); err != nil {
|
||||
if err := {{.LowerType}}_Validate(row); err != nil {
|
||||
return row, err
|
||||
}
|
||||
|
||||
@@ -79,9 +79,9 @@ func {{.LowerType}}_Update(
|
||||
func {{.LowerType}}_UpdateFull(
|
||||
tx dbConn,
|
||||
row {{.Type}},
|
||||
) (row {{.Type}}, err error) {
|
||||
) ({{.Type}}, error) {
|
||||
row = {{.LowerType}}_Sanitize(row)
|
||||
if err = {{.LowerType}}_Validate(row); err != nil {
|
||||
if err := {{.LowerType}}_Validate(row); err != nil {
|
||||
return row, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user