Fix lint errors for generated package
This commit is contained in:
parent
f803cdd6bd
commit
01f08efe8a
5 changed files with 17 additions and 5 deletions
|
@ -10,8 +10,11 @@ var (
|
|||
)
|
||||
|
||||
type (
|
||||
// {{$tableNameSingular}}Slice is an alias for a slice of pointers to {{$tableNameSingular}}.
|
||||
// This should generally be used opposed to []{{$tableNameSingular}}.
|
||||
{{$tableNameSingular}}Slice []*{{$tableNameSingular}}
|
||||
{{if eq .NoHooks false -}}
|
||||
// {{$tableNameSingular}}Hook is the signature for custom {{$tableNameSingular}} hook methods
|
||||
{{$tableNameSingular}}Hook func(boil.Executor, *{{$tableNameSingular}}) error
|
||||
{{- end}}
|
||||
|
||||
|
|
|
@ -111,6 +111,7 @@ func (o *{{$tableNameSingular}}) doAfterUpsertHooks(exec boil.Executor) (err err
|
|||
return nil
|
||||
}
|
||||
|
||||
// Add{{$tableNameSingular}}Hook registers your hook function for all future operations.
|
||||
func Add{{$tableNameSingular}}Hook(hookPoint boil.HookPoint, {{$varNameSingular}}Hook {{$tableNameSingular}}Hook) {
|
||||
switch hookPoint {
|
||||
case boil.BeforeInsertHook:
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
{{- $colDefs := sqlColDefinitions .Table.Columns .Table.PKey.Columns -}}
|
||||
{{- $pkNames := $colDefs.Names | stringMap .StringFuncs.camelCase -}}
|
||||
{{- $pkArgs := joinSlices " " $pkNames $colDefs.Types | join ", " -}}
|
||||
// {{$tableNameSingular}}FindG retrieves a single record by ID.
|
||||
// Find{{$tableNameSingular}}G retrieves a single record by ID.
|
||||
func Find{{$tableNameSingular}}G({{$pkArgs}}, selectCols ...string) (*{{$tableNameSingular}}, error) {
|
||||
return Find{{$tableNameSingular}}(boil.GetDB(), {{$pkNames | join ", "}}, selectCols...)
|
||||
}
|
||||
|
||||
// {{$tableNameSingular}}FindGP retrieves a single record by ID, and panics on error.
|
||||
// Find{{$tableNameSingular}}GP retrieves a single record by ID, and panics on error.
|
||||
func Find{{$tableNameSingular}}GP({{$pkArgs}}, selectCols ...string) *{{$tableNameSingular}} {
|
||||
retobj, err := Find{{$tableNameSingular}}(boil.GetDB(), {{$pkNames | join ", "}}, selectCols...)
|
||||
if err != nil {
|
||||
|
@ -19,7 +19,7 @@ func Find{{$tableNameSingular}}GP({{$pkArgs}}, selectCols ...string) *{{$tableNa
|
|||
return retobj
|
||||
}
|
||||
|
||||
// {{$tableNameSingular}}Find retrieves a single record by ID with an executor.
|
||||
// Find{{$tableNameSingular}} retrieves a single record by ID with an executor.
|
||||
// If selectCols is empty Find will return all columns.
|
||||
func Find{{$tableNameSingular}}(exec boil.Executor, {{$pkArgs}}, selectCols ...string) (*{{$tableNameSingular}}, error) {
|
||||
{{$varNameSingular}}Obj := &{{$tableNameSingular}}{}
|
||||
|
@ -45,7 +45,7 @@ func Find{{$tableNameSingular}}(exec boil.Executor, {{$pkArgs}}, selectCols ...s
|
|||
return {{$varNameSingular}}Obj, nil
|
||||
}
|
||||
|
||||
// {{$tableNameSingular}}FindP retrieves a single record by ID with an executor, and panics on error.
|
||||
// Find{{$tableNameSingular}}P retrieves a single record by ID with an executor, and panics on error.
|
||||
func Find{{$tableNameSingular}}P(exec boil.Executor, {{$pkArgs}}, selectCols ...string) *{{$tableNameSingular}} {
|
||||
retobj, err := Find{{$tableNameSingular}}(exec, {{$pkNames | join ", "}}, selectCols...)
|
||||
if err != nil {
|
||||
|
|
|
@ -88,7 +88,7 @@ func (q {{$varNameSingular}}Query) DeleteAll() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// DeleteAll deletes all rows in the slice, and panics on error.
|
||||
// DeleteAllGP deletes all rows in the slice, and panics on error.
|
||||
func (o {{$tableNameSingular}}Slice) DeleteAllGP() {
|
||||
if err := o.DeleteAllG(); err != nil {
|
||||
panic(boil.WrapErr(err))
|
||||
|
|
|
@ -37,18 +37,26 @@ func (o *{{$tableNameSingular}}) Reload(exec boil.Executor) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// ReloadAllGP refetches every row with matching primary key column values
|
||||
// and overwrites the original object slice with the newly updated slice.
|
||||
// Panics on error.
|
||||
func (o *{{$tableNameSingular}}Slice) ReloadAllGP() {
|
||||
if err := o.ReloadAllG(); err != nil {
|
||||
panic(boil.WrapErr(err))
|
||||
}
|
||||
}
|
||||
|
||||
// ReloadAllP refetches every row with matching primary key column values
|
||||
// and overwrites the original object slice with the newly updated slice.
|
||||
// Panics on error.
|
||||
func (o *{{$tableNameSingular}}Slice) ReloadAllP(exec boil.Executor) {
|
||||
if err := o.ReloadAll(exec); err != nil {
|
||||
panic(boil.WrapErr(err))
|
||||
}
|
||||
}
|
||||
|
||||
// ReloadAllG refetches every row with matching primary key column values
|
||||
// and overwrites the original object slice with the newly updated slice.
|
||||
func (o *{{$tableNameSingular}}Slice) ReloadAllG() error {
|
||||
if o == nil {
|
||||
return errors.New("{{.PkgName}}: empty {{$tableNameSingular}}Slice provided for reload all")
|
||||
|
|
Loading…
Add table
Reference in a new issue