models

package
v0.0.0-...-6604dc5 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 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 SchemaMigrationColumns = struct {
	Version string
	Dirty   string
}{
	Version: "version",
	Dirty:   "dirty",
}
View Source
var SchemaMigrationRels = struct {
}{}

SchemaMigrationRels is where relationship names are stored.

View Source
var SchemaMigrationTableColumns = struct {
	Version string
	Dirty   string
}{
	Version: "schema_migrations.version",
	Dirty:   "schema_migrations.dirty",
}
View Source
var SchemaMigrationWhere = struct {
	Version whereHelperint64
	Dirty   whereHelperbool
}{
	Version: whereHelperint64{/* contains filtered or unexported fields */},
	Dirty:   whereHelperbool{/* contains filtered or unexported fields */},
}
View Source
var TableNames = struct {
	SchemaMigrations string
	Users            string
}{
	SchemaMigrations: "schema_migrations",
	Users:            "users",
}
View Source
var UserColumns = struct {
	ID        string
	CreatedAt string
	UpdatedAt string
	IsActive  string
	IsDeleted string
	IsAdmin   string
	Username  string
	Email     string
	Password  string
	FirstName string
	LastName  string
}{
	ID:        "id",
	CreatedAt: "created_at",
	UpdatedAt: "updated_at",
	IsActive:  "is_active",
	IsDeleted: "is_deleted",
	IsAdmin:   "is_admin",
	Username:  "username",
	Email:     "email",
	Password:  "password",
	FirstName: "first_name",
	LastName:  "last_name",
}
View Source
var UserRels = struct {
}{}

UserRels is where relationship names are stored.

View Source
var UserTableColumns = struct {
	ID        string
	CreatedAt string
	UpdatedAt string
	IsActive  string
	IsDeleted string
	IsAdmin   string
	Username  string
	Email     string
	Password  string
	FirstName string
	LastName  string
}{
	ID:        "users.id",
	CreatedAt: "users.created_at",
	UpdatedAt: "users.updated_at",
	IsActive:  "users.is_active",
	IsDeleted: "users.is_deleted",
	IsAdmin:   "users.is_admin",
	Username:  "users.username",
	Email:     "users.email",
	Password:  "users.password",
	FirstName: "users.first_name",
	LastName:  "users.last_name",
}
View Source
var UserWhere = struct {
	ID        whereHelperint
	CreatedAt whereHelpernull_Time
	UpdatedAt whereHelpernull_Time
	IsActive  whereHelpernull_Bool
	IsDeleted whereHelpernull_Bool
	IsAdmin   whereHelpernull_Bool
	Username  whereHelperstring
	Email     whereHelperstring
	Password  whereHelperstring
	FirstName whereHelperstring
	LastName  whereHelperstring
}{
	ID:        whereHelperint{/* contains filtered or unexported fields */},
	CreatedAt: whereHelpernull_Time{/* contains filtered or unexported fields */},
	UpdatedAt: whereHelpernull_Time{/* contains filtered or unexported fields */},
	IsActive:  whereHelpernull_Bool{/* contains filtered or unexported fields */},
	IsDeleted: whereHelpernull_Bool{/* contains filtered or unexported fields */},
	IsAdmin:   whereHelpernull_Bool{/* contains filtered or unexported fields */},
	Username:  whereHelperstring{/* contains filtered or unexported fields */},
	Email:     whereHelperstring{/* contains filtered or unexported fields */},
	Password:  whereHelperstring{/* contains filtered or unexported fields */},
	FirstName: whereHelperstring{/* contains filtered or unexported fields */},
	LastName:  whereHelperstring{/* contains filtered or unexported fields */},
}
View Source
var ViewNames = struct {
}{}

Functions

func AddSchemaMigrationHook

func AddSchemaMigrationHook(hookPoint boil.HookPoint, schemaMigrationHook SchemaMigrationHook)

AddSchemaMigrationHook registers your hook function for all future operations.

func AddUserHook

func AddUserHook(hookPoint boil.HookPoint, userHook UserHook)

AddUserHook 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 SchemaMigrationExists

func SchemaMigrationExists(ctx context.Context, exec boil.ContextExecutor, version int64) (bool, error)

SchemaMigrationExists checks if the SchemaMigration row exists.

func SchemaMigrations

func SchemaMigrations(mods ...qm.QueryMod) schemaMigrationQuery

SchemaMigrations retrieves all the records using an executor.

func UserExists

func UserExists(ctx context.Context, exec boil.ContextExecutor, iD int) (bool, error)

UserExists checks if the User row exists.

func Users

func Users(mods ...qm.QueryMod) userQuery

Users 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 SchemaMigration

type SchemaMigration struct {
	Version int64 `boil:"version" json:"version" toml:"version" yaml:"version"`
	Dirty   bool  `boil:"dirty" json:"dirty" toml:"dirty" yaml:"dirty"`

	R *schemaMigrationR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L schemaMigrationL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

SchemaMigration is an object representing the database table.

func FindSchemaMigration

func FindSchemaMigration(ctx context.Context, exec boil.ContextExecutor, version int64, selectCols ...string) (*SchemaMigration, error)

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

func (*SchemaMigration) Delete

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

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

func (*SchemaMigration) Exists

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

Exists checks if the SchemaMigration row exists.

func (*SchemaMigration) Insert

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

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

func (*SchemaMigration) Update

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

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

func (o *SchemaMigration) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns, opts ...UpsertOptionFunc) 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 SchemaMigrationHook

type SchemaMigrationHook func(context.Context, boil.ContextExecutor, *SchemaMigration) error

SchemaMigrationHook is the signature for custom SchemaMigration hook methods

type SchemaMigrationSlice

type SchemaMigrationSlice []*SchemaMigration

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

func (SchemaMigrationSlice) DeleteAll

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

func (*SchemaMigrationSlice) ReloadAll

ReloadAll refetches every row with matching primary key column values and overwrites the original object slice with the newly updated slice.

func (SchemaMigrationSlice) UpdateAll

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

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

type UpsertOptionFunc

type UpsertOptionFunc func(o *UpsertOptions)

func UpsertConflictTarget

func UpsertConflictTarget(conflictTarget string) UpsertOptionFunc

func UpsertUpdateSet

func UpsertUpdateSet(updateSet string) UpsertOptionFunc

type UpsertOptions

type UpsertOptions struct {
	// contains filtered or unexported fields
}

type User

type User struct {
	ID        int       `boil:"id" json:"id" toml:"id" yaml:"id"`
	CreatedAt null.Time `boil:"created_at" json:"created_at,omitempty" toml:"created_at" yaml:"created_at,omitempty"`
	UpdatedAt null.Time `boil:"updated_at" json:"updated_at,omitempty" toml:"updated_at" yaml:"updated_at,omitempty"`
	IsActive  null.Bool `boil:"is_active" json:"is_active,omitempty" toml:"is_active" yaml:"is_active,omitempty"`
	IsDeleted null.Bool `boil:"is_deleted" json:"is_deleted,omitempty" toml:"is_deleted" yaml:"is_deleted,omitempty"`
	IsAdmin   null.Bool `boil:"is_admin" json:"is_admin,omitempty" toml:"is_admin" yaml:"is_admin,omitempty"`
	Username  string    `boil:"username" json:"username" toml:"username" yaml:"username"`
	Email     string    `boil:"email" json:"email" toml:"email" yaml:"email"`
	Password  string    `boil:"password" json:"password" toml:"password" yaml:"password"`
	FirstName string    `boil:"first_name" json:"first_name" toml:"first_name" yaml:"first_name"`
	LastName  string    `boil:"last_name" json:"last_name" toml:"last_name" yaml:"last_name"`

	R *userR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L userL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

User is an object representing the database table.

func FindUser

func FindUser(ctx context.Context, exec boil.ContextExecutor, iD int, selectCols ...string) (*User, error)

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

func (*User) Delete

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

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

func (*User) Exists

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

Exists checks if the User row exists.

func (*User) Insert

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

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

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

func (*User) Update

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

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

func (o *User) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns, opts ...UpsertOptionFunc) 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 UserHook

type UserHook func(context.Context, boil.ContextExecutor, *User) error

UserHook is the signature for custom User hook methods

type UserSlice

type UserSlice []*User

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

func (UserSlice) DeleteAll

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

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

func (*UserSlice) ReloadAll

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

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