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: 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 NamespaceColumns = struct {
	Name        string
	URL         string
	Type        string
	CSCDBSize   string
	CSCDBMtime  string
	CSCDBSha256 string
	Status      string
	Description string
	CreatedAt   string
	UpdatedAt   string
}{
	Name:        "name",
	URL:         "url",
	Type:        "type",
	CSCDBSize:   "csc_db_size",
	CSCDBMtime:  "csc_db_mtime",
	CSCDBSha256: "csc_db_sha256",
	Status:      "status",
	Description: "description",
	CreatedAt:   "created_at",
	UpdatedAt:   "updated_at",
}
View Source
var NamespaceRels = struct {
}{}

NamespaceRels is where relationship names are stored.

View Source
var NamespaceWhere = struct {
	Name        whereHelperstring
	URL         whereHelperstring
	Type        whereHelperstring
	CSCDBSize   whereHelperint64
	CSCDBMtime  whereHelpertime_Time
	CSCDBSha256 whereHelperstring
	Status      whereHelperstring
	Description whereHelperstring
	CreatedAt   whereHelpertime_Time
	UpdatedAt   whereHelpertime_Time
}{
	Name:        whereHelperstring{/* contains filtered or unexported fields */},
	URL:         whereHelperstring{/* contains filtered or unexported fields */},
	Type:        whereHelperstring{/* contains filtered or unexported fields */},
	CSCDBSize:   whereHelperint64{/* contains filtered or unexported fields */},
	CSCDBMtime:  whereHelpertime_Time{/* contains filtered or unexported fields */},
	CSCDBSha256: whereHelperstring{/* contains filtered or unexported fields */},
	Status:      whereHelperstring{/* contains filtered or unexported fields */},
	Description: 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 ObjectColumns = struct {
	ID        string
	Namespace string
	Path      string
	Type      string
	Size      string
	Mtime     string
	Sha256    string
	Status    string
	CreatedAt string
	UpdatedAt string
}{
	ID:        "id",
	Namespace: "namespace",
	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        whereHelperint
	Namespace whereHelperstring
	Path      whereHelperstring
	Type      whereHelperstring
	Size      whereHelperint64
	Mtime     whereHelpertime_Time
	Sha256    whereHelperstring
	Status    whereHelperstring
	CreatedAt whereHelpertime_Time
	UpdatedAt whereHelpertime_Time
}{
	ID:        whereHelperint{/* contains filtered or unexported fields */},
	Namespace: whereHelperstring{/* 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 {
	Namespaces string
	Objects    string
}{
	Namespaces: "namespaces",
	Objects:    "objects",
}

Functions

func AddNamespaceHook

func AddNamespaceHook(hookPoint boil.HookPoint, namespaceHook NamespaceHook)

AddNamespaceHook registers your hook function for all future operations.

func AddObjectHook

func AddObjectHook(hookPoint boil.HookPoint, objectHook ObjectHook)

AddObjectHook registers your hook function for all future operations.

func NamespaceExists

func NamespaceExists(ctx context.Context, exec boil.ContextExecutor, name string) (bool, error)

NamespaceExists checks if the Namespace row exists.

func Namespaces

func Namespaces(mods ...qm.QueryMod) namespaceQuery

Namespaces 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

func ObjectExists

func ObjectExists(ctx context.Context, exec boil.ContextExecutor, iD int) (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 Namespace

type Namespace struct {
	Name        string    `boil:"name" json:"name" toml:"name" yaml:"name"`
	URL         string    `boil:"url" json:"url" toml:"url" yaml:"url"`
	Type        string    `boil:"type" json:"type" toml:"type" yaml:"type"`
	CSCDBSize   int64     `boil:"csc_db_size" json:"csc_db_size" toml:"csc_db_size" yaml:"csc_db_size"`
	CSCDBMtime  time.Time `boil:"csc_db_mtime" json:"csc_db_mtime" toml:"csc_db_mtime" yaml:"csc_db_mtime"`
	CSCDBSha256 string    `boil:"csc_db_sha256" json:"csc_db_sha256" toml:"csc_db_sha256" yaml:"csc_db_sha256"`
	Status      string    `boil:"status" json:"status" toml:"status" yaml:"status"`
	Description string    `boil:"description" json:"description" toml:"description" yaml:"description"`
	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 *namespaceR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L namespaceL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Namespace is an object representing the database table.

func FindNamespace

func FindNamespace(ctx context.Context, exec boil.ContextExecutor, name string, selectCols ...string) (*Namespace, error)

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

func (*Namespace) Delete

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

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

func (*Namespace) Insert

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

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

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

func (*Namespace) Update

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

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

func (o *Namespace) Upsert(ctx context.Context, exec boil.ContextExecutor, 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 NamespaceHook

type NamespaceHook func(context.Context, boil.ContextExecutor, *Namespace) error

NamespaceHook is the signature for custom Namespace hook methods

type NamespaceSlice

type NamespaceSlice []*Namespace

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

func (NamespaceSlice) DeleteAll

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

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

func (*NamespaceSlice) ReloadAll

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

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

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

type Object

type Object struct {
	ID        int       `boil:"id" json:"id" toml:"id" yaml:"id"`
	Namespace string    `boil:"namespace" json:"namespace" toml:"namespace" yaml:"namespace"`
	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 int, 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.

func (*Object) Upsert

func (o *Object) Upsert(ctx context.Context, exec boil.ContextExecutor, 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 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