models

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: Apache-2.0 Imports: 16 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 ObjectColumns = struct {
	ID        string
	Path      string
	Type      string
	Size      string
	Mtime     string
	Sha256    string
	Status    string
	CreatedAt string
	UpdatedAt string
}{
	ID:        "id",
	Path:      "path",
	Type:      "type",
	Size:      "size",
	Mtime:     "mtime",
	Sha256:    "sha256",
	Status:    "status",
	CreatedAt: "created_at",
	UpdatedAt: "updated_at",
}
View Source
var ObjectRels = struct {
}{}

ObjectRels is where relationship names are stored.

View Source
var ObjectWhere = struct {
	ID        whereHelpernull_Int64
	Path      whereHelperstring
	Type      whereHelperstring
	Size      whereHelperint64
	Mtime     whereHelpertime_Time
	Sha256    whereHelperstring
	Status    whereHelperstring
	CreatedAt whereHelpertime_Time
	UpdatedAt whereHelpertime_Time
}{
	ID:        whereHelpernull_Int64{/* contains filtered or unexported fields */},
	Path:      whereHelperstring{/* contains filtered or unexported fields */},
	Type:      whereHelperstring{/* contains filtered or unexported fields */},
	Size:      whereHelperint64{/* contains filtered or unexported fields */},
	Mtime:     whereHelpertime_Time{/* contains filtered or unexported fields */},
	Sha256:    whereHelperstring{/* contains filtered or unexported fields */},
	Status:    whereHelperstring{/* contains filtered or unexported fields */},
	CreatedAt: whereHelpertime_Time{/* contains filtered or unexported fields */},
	UpdatedAt: whereHelpertime_Time{/* contains filtered or unexported fields */},
}
View Source
var TableNames = struct {
	Objects string
}{
	Objects: "objects",
}

Functions

func AddObjectHook

func AddObjectHook(hookPoint boil.HookPoint, objectHook ObjectHook)

AddObjectHook 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 ObjectExists

func ObjectExists(ctx context.Context, exec boil.ContextExecutor, iD null.Int64) (bool, error)

ObjectExists checks if the Object row exists.

func Objects

func Objects(mods ...qm.QueryMod) objectQuery

Objects 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 Object

type Object struct {
	ID        null.Int64 `boil:"id" json:"id,omitempty" toml:"id" yaml:"id,omitempty"`
	Path      string     `boil:"path" json:"path" toml:"path" yaml:"path"`
	Type      string     `boil:"type" json:"type" toml:"type" yaml:"type"`
	Size      int64      `boil:"size" json:"size" toml:"size" yaml:"size"`
	Mtime     time.Time  `boil:"mtime" json:"mtime" toml:"mtime" yaml:"mtime"`
	Sha256    string     `boil:"sha256" json:"sha256" toml:"sha256" yaml:"sha256"`
	Status    string     `boil:"status" json:"status" toml:"status" yaml:"status"`
	CreatedAt time.Time  `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
	UpdatedAt time.Time  `boil:"updated_at" json:"updated_at" toml:"updated_at" yaml:"updated_at"`

	R *objectR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L objectL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Object is an object representing the database table.

func FindObject

func FindObject(ctx context.Context, exec boil.ContextExecutor, iD null.Int64, selectCols ...string) (*Object, error)

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

func (*Object) Delete

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

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

func (*Object) Insert

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

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

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

func (*Object) Update

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

Update uses an executor to update the Object. 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.

type ObjectHook

type ObjectHook func(context.Context, boil.ContextExecutor, *Object) error

ObjectHook is the signature for custom Object hook methods

type ObjectSlice

type ObjectSlice []*Object

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

func (ObjectSlice) DeleteAll

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

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

func (*ObjectSlice) ReloadAll

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

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