Documentation
¶
Index ¶
- Variables
- func AddModelHook(hookPoint boil.HookPoint, modelHook ModelHook)
- func ModelExists(ctx context.Context, exec boil.ContextExecutor, iD int64) (bool, error)
- func Models(mods ...qm.QueryMod) modelQuery
- func NewQuery(mods ...qm.QueryMod) *queries.Query
- type M
- type Model
- func (o *Model) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, error)
- func (o *Model) Insert(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) error
- func (o *Model) Reload(ctx context.Context, exec boil.ContextExecutor) error
- func (o *Model) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error)
- func (o *Model) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, ...) error
- type ModelHook
- type ModelSlice
Constants ¶
This section is empty.
Variables ¶
var ErrSyncFail = errors.New("models: failed to synchronize data after insert")
ErrSyncFail occurs during insert when the record could not be retrieved in order to populate default value information. This usually happens when LastInsertId fails or there was a primary key configuration that was not resolvable.
var ModelColumns = struct { ID string Name string Title string Fax string Web string Age string Right string Counter string }{ ID: "id", Name: "name", Title: "title", Fax: "fax", Web: "web", Age: "age", Right: "right", Counter: "counter", }
var ModelRels = struct {
}{}
ModelRels is where relationship names are stored.
var ModelTableColumns = struct { ID string Name string Title string Fax string Web string Age string Right string Counter string }{ ID: "models.id", Name: "models.name", Title: "models.title", Fax: "models.fax", Web: "models.web", Age: "models.age", Right: "models.right", Counter: "models.counter", }
var ModelWhere = struct { ID whereHelperint64 Name whereHelperstring Title whereHelperstring Fax whereHelperstring Web whereHelperstring Age whereHelperint64 Right whereHelperbool Counter whereHelperint64 }{ ID: whereHelperint64{/* contains filtered or unexported fields */}, Name: whereHelperstring{/* contains filtered or unexported fields */}, Title: whereHelperstring{/* contains filtered or unexported fields */}, Fax: whereHelperstring{/* contains filtered or unexported fields */}, Web: whereHelperstring{/* contains filtered or unexported fields */}, Age: whereHelperint64{/* contains filtered or unexported fields */}, Right: whereHelperbool{/* contains filtered or unexported fields */}, Counter: whereHelperint64{/* contains filtered or unexported fields */}, }
var TableNames = struct { Model string Models string ModelsGorp string }{ Model: "model", Models: "models", ModelsGorp: "models_gorp", }
Functions ¶
func AddModelHook ¶
AddModelHook registers your hook function for all future operations.
func ModelExists ¶
ModelExists checks if the Model row exists.
Types ¶
type M ¶
type M map[string]interface{}
M type is for providing columns and column values to UpdateAll.
type Model ¶
type Model struct { ID int64 `boil:"id" json:"id" toml:"id" yaml:"id"` Name string `boil:"name" json:"name" toml:"name" yaml:"name"` Title string `boil:"title" json:"title" toml:"title" yaml:"title"` Fax string `boil:"fax" json:"fax" toml:"fax" yaml:"fax"` Web string `boil:"web" json:"web" toml:"web" yaml:"web"` Age int64 `boil:"age" json:"age" toml:"age" yaml:"age"` Right bool `boil:"right" json:"right" toml:"right" yaml:"right"` Counter int64 `boil:"counter" json:"counter" toml:"counter" yaml:"counter"` R *modelR `boil:"-" json:"-" toml:"-" yaml:"-"` L modelL `boil:"-" json:"-" toml:"-" yaml:"-"` }
Model is an object representing the database table.
func FindModel ¶
func FindModel(ctx context.Context, exec boil.ContextExecutor, iD int64, selectCols ...string) (*Model, error)
FindModel retrieves a single record by ID with an executor. If selectCols is empty Find will return all columns.
func (*Model) Delete ¶
Delete deletes a single Model record with an executor. Delete will match against the primary key column to find the record to delete.
func (*Model) Insert ¶
Insert a single record using an executor. See boil.Columns.InsertColumnSet documentation to understand column list inference for inserts.
func (*Model) Reload ¶
Reload refetches the object from the database using the primary keys with an executor.
func (*Model) Update ¶
func (o *Model) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error)
Update uses an executor to update the Model. See boil.Columns.UpdateColumnSet documentation to understand column list inference for updates. Update does not automatically update the record in case of default values. Use .Reload() to refresh the records.
func (*Model) Upsert ¶
func (o *Model) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error
Upsert attempts an insert using an executor, and does an update or ignore on conflict. See boil.Columns documentation for how to properly use updateColumns and insertColumns.
type ModelSlice ¶
type ModelSlice []*Model
ModelSlice is an alias for a slice of pointers to Model. This should almost always be used instead of []Model.
func (ModelSlice) DeleteAll ¶
func (o ModelSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error)
DeleteAll deletes all rows in the slice, using an executor.
func (*ModelSlice) ReloadAll ¶
func (o *ModelSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error
ReloadAll refetches every row with matching primary key column values and overwrites the original object slice with the newly updated slice.
func (ModelSlice) UpdateAll ¶
func (o ModelSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error)
UpdateAll updates all rows with the specified column values, using an executor.