Unexport partial...update() store functions, fix messaging

This commit is contained in:
Denis Arh
2020-09-09 13:27:27 +02:00
parent edbeb57f48
commit 464a8ecd93
52 changed files with 90 additions and 224 deletions
-6
View File
@@ -33,7 +33,6 @@ type (
{{- end }}
{{ if .Update.Enable }}
Update{{ export $Types.Singular }}(ctx context.Context{{ template "extraArgsDef" . }}, rr ... *{{ $Types.GoType }}) error
Partial{{ export $Types.Singular }}Update(ctx context.Context{{ template "extraArgsDef" . }}, onlyColumns []string, rr ... *{{ $Types.GoType }}) error
{{- end }}
{{ if .Upsert.Enable }}
Upsert{{ export $Types.Singular }}(ctx context.Context{{ template "extraArgsDef" . }}, rr ... *{{ $Types.GoType }}) error
@@ -88,11 +87,6 @@ func Create{{ export $Types.Singular }}(ctx context.Context, s {{ export $Types.
func Update{{ export $Types.Singular }}(ctx context.Context, s {{ export $Types.Plural }}{{ template "extraArgsDef" . }}, rr ... *{{ $Types.GoType }}) error {
return s.Update{{ export $Types.Singular }}(ctx{{ template "extraArgsCall" . }}, rr... )
}
// Partial{{ export $.Types.Singular }}Update updates one or more existing {{ $.Types.Plural }} in store
func Partial{{ export $Types.Singular }}Update(ctx context.Context, s {{ export $Types.Plural }}{{ template "extraArgsDef" . }}, onlyColumns []string, rr ... *{{ $Types.GoType }}) error {
return s.Partial{{ export $Types.Singular }}Update(ctx{{ template "extraArgsCall" . }}, onlyColumns, rr...)
}
{{ end }}
{{ if .Upsert.Enable }}
+3 -3
View File
@@ -341,11 +341,11 @@ func (s Store) {{ toggleExport .Create.Export "Create" $.Types.Singular }}(ctx c
{{ if .Update.Enable }}
// {{ toggleExport .Update.Export "Update" $.Types.Singular }} updates one or more existing rows in {{ $.RDBMS.Table }}
func (s Store) {{ toggleExport .Update.Export "Update" $.Types.Singular }}(ctx context.Context{{ template "extraArgsDef" . }}, rr ... *{{ $.Types.GoType }}) error {
return s.config.ErrorHandler(s.{{ toggleExport .Update.Export "Partial" $.Types.Singular "Update" }}(ctx{{ template "extraArgsCall" . }}, nil, rr...))
return s.config.ErrorHandler(s.partial{{ export $.Types.Singular "Update" }}(ctx{{ template "extraArgsCall" . }}, nil, rr...))
}
// {{ toggleExport .Update.Export "Partial" $.Types.Singular "Update" }} updates one or more existing rows in {{ $.RDBMS.Table }}
func (s Store) {{ toggleExport .Update.Export "Partial" $.Types.Singular "Update" }}(ctx context.Context{{ template "extraArgsDef" . }}, onlyColumns []string, rr ... *{{ $.Types.GoType }}) (err error) {
// partial{{ export $.Types.Singular "Update" }} updates one or more existing rows in {{ $.RDBMS.Table }}
func (s Store) partial{{ export $.Types.Singular "Update" }}(ctx context.Context{{ template "extraArgsDef" . }}, onlyColumns []string, rr ... *{{ $.Types.GoType }}) (err error) {
for _, res := range rr {
err = s.check{{ export $.Types.Singular }}Constraints(ctx {{ template "extraArgsCall" $ }}, res)
if err != nil {