models

package
v0.0.0-...-b2d85d4 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2020 License: AGPL-3.0 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 TableNames = struct {
	Todos string
}{
	Todos: "todos",
}
View Source
var TodoColumns = struct {
	ID        string
	Title     string
	Body      string
	Index     string
	Namespace string
}{
	ID:        "id",
	Title:     "title",
	Body:      "body",
	Index:     "index",
	Namespace: "namespace",
}
View Source
var TodoRels = struct {
}{}

TodoRels is where relationship names are stored.

View Source
var TodoWhere = struct {
	ID        whereHelperint
	Title     whereHelperstring
	Body      whereHelperstring
	Index     whereHelperint64
	Namespace whereHelperstring
}{
	ID:        whereHelperint{/* contains filtered or unexported fields */},
	Title:     whereHelperstring{/* contains filtered or unexported fields */},
	Body:      whereHelperstring{/* contains filtered or unexported fields */},
	Index:     whereHelperint64{/* contains filtered or unexported fields */},
	Namespace: whereHelperstring{/* contains filtered or unexported fields */},
}

Functions

func AddTodoHook

func AddTodoHook(hookPoint boil.HookPoint, todoHook TodoHook)

AddTodoHook registers your hook function for all future operations.

func NewQuery

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

NewQuery initializes a new Query using the passed in QueryMods

func TodoExists

func TodoExists(ctx context.Context, exec boil.ContextExecutor, iD int) (bool, error)

TodoExists checks if the Todo row exists.

func Todos

func Todos(mods ...qm.QueryMod) todoQuery

Todos retrieves all the records using an executor.

Types

type M

type M map[string]interface{}

M type is for providing columns and column values to UpdateAll.

type Todo

type Todo struct {
	ID        int    `boil:"id" json:"id" toml:"id" yaml:"id"`
	Title     string `boil:"title" json:"title" toml:"title" yaml:"title"`
	Body      string `boil:"body" json:"body" toml:"body" yaml:"body"`
	Index     int64  `boil:"index" json:"index" toml:"index" yaml:"index"`
	Namespace string `boil:"namespace" json:"namespace" toml:"namespace" yaml:"namespace"`

	R *todoR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L todoL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Todo is an object representing the database table.

func FindTodo

func FindTodo(ctx context.Context, exec boil.ContextExecutor, iD int, selectCols ...string) (*Todo, error)

FindTodo retrieves a single record by ID with an executor. If selectCols is empty Find will return all columns.

func (*Todo) Delete

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

Delete deletes a single Todo record with an executor. Delete will match against the primary key column to find the record to delete.

func (*Todo) Insert

func (o *Todo) 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 (*Todo) Reload

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

Reload refetches the object from the database using the primary keys with an executor.

func (*Todo) Update

func (o *Todo) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error)

Update uses an executor to update the Todo. 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 (*Todo) Upsert

func (o *Todo) 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 TodoHook

type TodoHook func(context.Context, boil.ContextExecutor, *Todo) error

TodoHook is the signature for custom Todo hook methods

type TodoSlice

type TodoSlice []*Todo

TodoSlice is an alias for a slice of pointers to Todo. This should generally be used opposed to []Todo.

func (TodoSlice) DeleteAll

func (o TodoSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error)

DeleteAll deletes all rows in the slice, using an executor.

func (*TodoSlice) ReloadAll

func (o *TodoSlice) 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 (TodoSlice) UpdateAll

func (o TodoSlice) 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