models

package
v0.0.0-...-c902aac Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 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 ShortenerColumns = struct {
	Code    string
	URL     string
	Visited string
	Count   string
}{
	Code:    "code",
	URL:     "url",
	Visited: "visited",
	Count:   "count",
}
View Source
var ShortenerRels = struct {
}{}

ShortenerRels is where relationship names are stored.

View Source
var ShortenerWhere = struct {
	Code    whereHelperstring
	URL     whereHelperstring
	Visited whereHelperbool
	Count   whereHelperint
}{
	Code:    whereHelperstring{/* contains filtered or unexported fields */},
	URL:     whereHelperstring{/* contains filtered or unexported fields */},
	Visited: whereHelperbool{/* contains filtered or unexported fields */},
	Count:   whereHelperint{/* contains filtered or unexported fields */},
}
View Source
var TableNames = struct {
	Shortener string
}{
	Shortener: "shortener",
}

Functions

func AddShortenerHook

func AddShortenerHook(hookPoint boil.HookPoint, shortenerHook ShortenerHook)

AddShortenerHook 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 ShortenerExists

func ShortenerExists(ctx context.Context, exec boil.ContextExecutor, code string) (bool, error)

ShortenerExists checks if the Shortener row exists.

func Shorteners

func Shorteners(mods ...qm.QueryMod) shortenerQuery

Shorteners 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 Shortener

type Shortener struct {
	Code    string `boil:"code" json:"code" toml:"code" yaml:"code"`
	URL     string `boil:"url" json:"url" toml:"url" yaml:"url"`
	Visited bool   `boil:"visited" json:"visited" toml:"visited" yaml:"visited"`
	Count   int    `boil:"count" json:"count" toml:"count" yaml:"count"`

	R *shortenerR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L shortenerL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Shortener is an object representing the database table.

func FindShortener

func FindShortener(ctx context.Context, exec boil.ContextExecutor, code string, selectCols ...string) (*Shortener, error)

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

func (*Shortener) Delete

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

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

func (*Shortener) Insert

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

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

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

func (*Shortener) Update

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

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

func (o *Shortener) 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 ShortenerHook

type ShortenerHook func(context.Context, boil.ContextExecutor, *Shortener) error

ShortenerHook is the signature for custom Shortener hook methods

type ShortenerSlice

type ShortenerSlice []*Shortener

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

func (ShortenerSlice) DeleteAll

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

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

func (*ShortenerSlice) ReloadAll

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

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