models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CounterColumns = struct {
	UserID string
	Count  string
}{
	UserID: "user_id",
	Count:  "count",
}
View Source
var CounterRels = struct {
}{}

CounterRels is where relationship names are stored.

View Source
var CounterTableColumns = struct {
	UserID string
	Count  string
}{
	UserID: "counters.user_id",
	Count:  "counters.count",
}
View Source
var CounterWhere = struct {
	UserID whereHelperstring
	Count  whereHelperint64
}{
	UserID: whereHelperstring{/* contains filtered or unexported fields */},
	Count:  whereHelperint64{/* contains filtered or unexported fields */},
}
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 {
	Counters string
}{
	Counters: "counters",
}
View Source
var ViewNames = struct {
}{}

Functions

func AddCounterHook

func AddCounterHook(hookPoint boil.HookPoint, counterHook CounterHook)

AddCounterHook registers your hook function for all future operations.

func CounterExists

func CounterExists(ctx context.Context, exec boil.ContextExecutor, userID string) (bool, error)

CounterExists checks if the Counter row exists.

func Counters

func Counters(mods ...qm.QueryMod) counterQuery

Counters 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 Counter

type Counter struct {
	UserID string `boil:"user_id" json:"user_id" toml:"user_id" yaml:"user_id"`
	Count  int64  `boil:"count" json:"count" toml:"count" yaml:"count"`

	R *counterR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L counterL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Counter is an object representing the database table.

func FindCounter

func FindCounter(ctx context.Context, exec boil.ContextExecutor, userID string, selectCols ...string) (*Counter, error)

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

func (*Counter) Delete

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

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

func (*Counter) Exists

func (o *Counter) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error)

Exists checks if the Counter row exists.

func (*Counter) Insert

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

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

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

func (*Counter) Update

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

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

func (o *Counter) 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 CounterHook

type CounterHook func(context.Context, boil.ContextExecutor, *Counter) error

CounterHook is the signature for custom Counter hook methods

type CounterSlice

type CounterSlice []*Counter

CounterSlice is an alias for a slice of pointers to Counter. This should almost always be used instead of []Counter.

func (CounterSlice) DeleteAll

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

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

func (*CounterSlice) ReloadAll

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

func (o CounterSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error)

UpdateAll updates all rows with the specified column values, using an executor.

type M

type M map[string]interface{}

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

Jump to

Keyboard shortcuts

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