models

package
v0.0.0-...-f8334dc Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2019 License: MIT Imports: 17 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 RoleColumns = struct {
	ID          string
	GuildID     string
	Name        string
	Permissions string
}{
	ID:          "id",
	GuildID:     "guild_id",
	Name:        "name",
	Permissions: "permissions",
}
View Source
var RoleRels = struct {
	RoleTargets string
}{
	RoleTargets: "RoleTargets",
}

RoleRels is where relationship names are stored.

View Source
var RoleTargetColumns = struct {
	ID     string
	Target string
	RoleID string
}{
	ID:     "id",
	Target: "target",
	RoleID: "role_id",
}
View Source
var RoleTargetRels = struct {
	Role string
}{
	Role: "Role",
}

RoleTargetRels is where relationship names are stored.

View Source
var RoleTargetWhere = struct {
	ID     whereHelperint64
	Target whereHelperstring
	RoleID whereHelperint64
}{
	ID:     whereHelperint64{/* contains filtered or unexported fields */},
	Target: whereHelperstring{/* contains filtered or unexported fields */},
	RoleID: whereHelperint64{/* contains filtered or unexported fields */},
}
View Source
var RoleWhere = struct {
	ID          whereHelperint64
	GuildID     whereHelpernull_String
	Name        whereHelperstring
	Permissions whereHelpertypes_Int64Array
}{
	ID:          whereHelperint64{/* contains filtered or unexported fields */},
	GuildID:     whereHelpernull_String{/* contains filtered or unexported fields */},
	Name:        whereHelperstring{/* contains filtered or unexported fields */},
	Permissions: whereHelpertypes_Int64Array{/* contains filtered or unexported fields */},
}
View Source
var TableNames = struct {
	RoleTargets string
	Roles       string
}{
	RoleTargets: "role_targets",
	Roles:       "roles",
}

Functions

func AddRoleHook

func AddRoleHook(hookPoint boil.HookPoint, roleHook RoleHook)

AddRoleHook registers your hook function for all future operations.

func AddRoleTargetHook

func AddRoleTargetHook(hookPoint boil.HookPoint, roleTargetHook RoleTargetHook)

AddRoleTargetHook 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 RoleExists

func RoleExists(ctx context.Context, exec boil.ContextExecutor, iD int64) (bool, error)

RoleExists checks if the Role row exists.

func RoleTargetExists

func RoleTargetExists(ctx context.Context, exec boil.ContextExecutor, iD int64) (bool, error)

RoleTargetExists checks if the RoleTarget row exists.

func RoleTargets

func RoleTargets(mods ...qm.QueryMod) roleTargetQuery

RoleTargets retrieves all the records using an executor.

func Roles

func Roles(mods ...qm.QueryMod) roleQuery

Roles 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 Role

type Role struct {
	ID          int64            `boil:"id" json:"id" toml:"id" yaml:"id"`
	GuildID     null.String      `boil:"guild_id" json:"guild_id,omitempty" toml:"guild_id" yaml:"guild_id,omitempty"`
	Name        string           `boil:"name" json:"name" toml:"name" yaml:"name"`
	Permissions types.Int64Array `boil:"permissions" json:"permissions" toml:"permissions" yaml:"permissions"`

	R *roleR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L roleL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Role is an object representing the database table.

func FindRole

func FindRole(ctx context.Context, exec boil.ContextExecutor, iD int64, selectCols ...string) (*Role, error)

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

func (*Role) AddRoleTargets

func (o *Role) AddRoleTargets(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*RoleTarget) error

AddRoleTargets adds the given related objects to the existing relationships of the role, optionally inserting them as new records. Appends related to o.R.RoleTargets. Sets related.R.Role appropriately.

func (*Role) Delete

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

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

func (*Role) Insert

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

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

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

func (*Role) RoleTargets

func (o *Role) RoleTargets(mods ...qm.QueryMod) roleTargetQuery

RoleTargets retrieves all the role_target's RoleTargets with an executor.

func (*Role) Update

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

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

func (o *Role) 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 RoleHook

type RoleHook func(context.Context, boil.ContextExecutor, *Role) error

RoleHook is the signature for custom Role hook methods

type RoleSlice

type RoleSlice []*Role

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

func (RoleSlice) DeleteAll

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

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

func (*RoleSlice) ReloadAll

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

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

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

type RoleTarget

type RoleTarget struct {
	ID     int64  `boil:"id" json:"id" toml:"id" yaml:"id"`
	Target string `boil:"target" json:"target" toml:"target" yaml:"target"`
	RoleID int64  `boil:"role_id" json:"role_id" toml:"role_id" yaml:"role_id"`

	R *roleTargetR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L roleTargetL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

RoleTarget is an object representing the database table.

func FindRoleTarget

func FindRoleTarget(ctx context.Context, exec boil.ContextExecutor, iD int64, selectCols ...string) (*RoleTarget, error)

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

func (*RoleTarget) Delete

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

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

func (*RoleTarget) Insert

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

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

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

func (*RoleTarget) Role

func (o *RoleTarget) Role(mods ...qm.QueryMod) roleQuery

Role pointed to by the foreign key.

func (*RoleTarget) SetRole

func (o *RoleTarget) SetRole(ctx context.Context, exec boil.ContextExecutor, insert bool, related *Role) error

SetRole of the roleTarget to the related item. Sets o.R.Role to related. Adds o to related.R.RoleTargets.

func (*RoleTarget) Update

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

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

func (o *RoleTarget) 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 RoleTargetHook

type RoleTargetHook func(context.Context, boil.ContextExecutor, *RoleTarget) error

RoleTargetHook is the signature for custom RoleTarget hook methods

type RoleTargetSlice

type RoleTargetSlice []*RoleTarget

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

func (RoleTargetSlice) DeleteAll

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

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

func (*RoleTargetSlice) ReloadAll

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

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