models

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
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",
}
View Source
var ModelRels = struct {
}{}

ModelRels is where relationship names are stored.

View Source
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",
}
View Source
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 */},
}
View Source
var TableNames = struct {
	Model      string
	Models     string
	ModelsGorp string
}{
	Model:      "model",
	Models:     "models",
	ModelsGorp: "models_gorp",
}

Functions

func AddModelHook

func AddModelHook(hookPoint boil.HookPoint, modelHook ModelHook)

AddModelHook registers your hook function for all future operations.

func ModelExists

func ModelExists(ctx context.Context, exec boil.ContextExecutor, iD int64) (bool, error)

ModelExists checks if the Model row exists.

func Models

func Models(mods ...qm.QueryMod) modelQuery

Models retrieves all the records using an executor.

func NewQuery

func NewQuery(mods ...qm.QueryMod) *queries.Query

NewQuery initializes a new Query using the passed in QueryMods

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

func (o *Model) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, error)

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

func (o *Model) Insert(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) error

Insert a single record using an executor. See boil.Columns.InsertColumnSet documentation to understand column list inference for inserts.

func (*Model) Reload

func (o *Model) Reload(ctx context.Context, exec boil.ContextExecutor) error

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 ModelHook

type ModelHook func(context.Context, boil.ContextExecutor, *Model) error

ModelHook is the signature for custom Model hook methods

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL