models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserRoleAdmin   = "admin"
	UserRoleStaff   = "staff"
	UserRoleUser    = "user"
	UserRoleDisable = "disable"
)

Enum values for user_role

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 TableNames = struct {
	UserProviders string
	Users         string
}{
	UserProviders: "user_providers",
	Users:         "users",
}
View Source
var UserColumns = struct {
	ID           string
	Email        string
	Password     string
	DisplayName  string
	Picture      string
	TokenVersion string
	Role         string
	CreatedAt    string
	UpdatedAt    string
}{
	ID:           "id",
	Email:        "email",
	Password:     "password",
	DisplayName:  "display_name",
	Picture:      "picture",
	TokenVersion: "token_version",
	Role:         "role",
	CreatedAt:    "created_at",
	UpdatedAt:    "updated_at",
}
View Source
var UserProviderColumns = struct {
	UserID     string
	Provider   string
	ProviderID string
	CreatedAt  string
	UpdatedAt  string
}{
	UserID:     "user_id",
	Provider:   "provider",
	ProviderID: "provider_id",
	CreatedAt:  "created_at",
	UpdatedAt:  "updated_at",
}
View Source
var UserProviderRels = struct {
	User string
}{
	User: "User",
}

UserProviderRels is where relationship names are stored.

View Source
var UserRels = struct {
	UserProviders string
}{
	UserProviders: "UserProviders",
}

UserRels is where relationship names are stored.

Functions

func AddUserHook

func AddUserHook(hookPoint boil.HookPoint, userHook UserHook)

AddUserHook registers your hook function for all future operations.

func AddUserProviderHook

func AddUserProviderHook(hookPoint boil.HookPoint, userProviderHook UserProviderHook)

AddUserProviderHook 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 UserExists

func UserExists(exec boil.Executor, iD int) (bool, error)

UserExists checks if the User row exists.

func UserExistsG

func UserExistsG(iD int) (bool, error)

UserExistsG checks if the User row exists.

func UserProviderExists

func UserProviderExists(exec boil.Executor, provider string, providerID string) (bool, error)

UserProviderExists checks if the UserProvider row exists.

func UserProviderExistsG

func UserProviderExistsG(provider string, providerID string) (bool, error)

UserProviderExistsG checks if the UserProvider row exists.

func UserProviders

func UserProviders(mods ...qm.QueryMod) userProviderQuery

UserProviders retrieves all the records using an executor.

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 User

type User struct {
	ID           int         `boil:"id" json:"id" toml:"id" yaml:"id"`
	Email        string      `boil:"email" json:"email" toml:"email" yaml:"email"`
	Password     null.String `boil:"password" json:"password,omitempty" toml:"password" yaml:"password,omitempty"`
	DisplayName  null.String `boil:"display_name" json:"display_name,omitempty" toml:"display_name" yaml:"display_name,omitempty"`
	Picture      null.String `boil:"picture" json:"picture,omitempty" toml:"picture" yaml:"picture,omitempty"`
	TokenVersion null.Int64  `boil:"token_version" json:"token_version,omitempty" toml:"token_version" yaml:"token_version,omitempty"`
	Role         string      `boil:"role" json:"role" toml:"role" yaml:"role"`
	CreatedAt    time.Time   `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
	UpdatedAt    null.Time   `boil:"updated_at" json:"updated_at,omitempty" toml:"updated_at" yaml:"updated_at,omitempty"`

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

User is an object representing the database table.

func FindUser

func FindUser(exec boil.Executor, 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 FindUserG

func FindUserG(iD int, selectCols ...string) (*User, error)

FindUserG retrieves a single record by ID.

func (*User) AddUserProviders

func (o *User) AddUserProviders(exec boil.Executor, insert bool, related ...*UserProvider) error

AddUserProviders adds the given related objects to the existing relationships of the user, optionally inserting them as new records. Appends related to o.R.UserProviders. Sets related.R.User appropriately.

func (*User) AddUserProvidersG

func (o *User) AddUserProvidersG(insert bool, related ...*UserProvider) error

AddUserProvidersG adds the given related objects to the existing relationships of the user, optionally inserting them as new records. Appends related to o.R.UserProviders. Sets related.R.User appropriately. Uses the global database handle.

func (*User) Delete

func (o *User) Delete(exec boil.Executor) (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) DeleteG

func (o *User) DeleteG() (int64, error)

DeleteG deletes a single User record. DeleteG will match against the primary key column to find the record to delete.

func (*User) Insert

func (o *User) Insert(exec boil.Executor, 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) InsertG

func (o *User) InsertG(columns boil.Columns) error

InsertG a single record. See Insert for whitelist behavior description.

func (*User) Reload

func (o *User) Reload(exec boil.Executor) error

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

func (*User) ReloadG

func (o *User) ReloadG() error

ReloadG refetches the object from the database using the primary keys.

func (*User) Update

func (o *User) Update(exec boil.Executor, 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) UpdateG

func (o *User) UpdateG(columns boil.Columns) (int64, error)

UpdateG a single User record using the global executor. See Update for more documentation.

func (*User) Upsert

func (o *User) Upsert(exec boil.Executor, 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.

func (*User) UpsertG

func (o *User) UpsertG(updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error

UpsertG attempts an insert, and does an update or ignore on conflict.

func (*User) UserProviders

func (o *User) UserProviders(mods ...qm.QueryMod) userProviderQuery

UserProviders retrieves all the user_provider's UserProviders with an executor.

type UserHook

type UserHook func(boil.Executor, *User) error

UserHook is the signature for custom User hook methods

type UserProvider

type UserProvider struct {
	UserID     int       `boil:"user_id" json:"user_id" toml:"user_id" yaml:"user_id"`
	Provider   string    `boil:"provider" json:"provider" toml:"provider" yaml:"provider"`
	ProviderID string    `boil:"provider_id" json:"provider_id" toml:"provider_id" yaml:"provider_id"`
	CreatedAt  time.Time `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
	UpdatedAt  null.Time `boil:"updated_at" json:"updated_at,omitempty" toml:"updated_at" yaml:"updated_at,omitempty"`

	R *userProviderR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L userProviderL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

UserProvider is an object representing the database table.

func FindUserProvider

func FindUserProvider(exec boil.Executor, provider string, providerID string, selectCols ...string) (*UserProvider, error)

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

func FindUserProviderG

func FindUserProviderG(provider string, providerID string, selectCols ...string) (*UserProvider, error)

FindUserProviderG retrieves a single record by ID.

func (*UserProvider) Delete

func (o *UserProvider) Delete(exec boil.Executor) (int64, error)

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

func (*UserProvider) DeleteG

func (o *UserProvider) DeleteG() (int64, error)

DeleteG deletes a single UserProvider record. DeleteG will match against the primary key column to find the record to delete.

func (*UserProvider) Insert

func (o *UserProvider) Insert(exec boil.Executor, columns boil.Columns) error

Insert a single record using an executor. See boil.Columns.InsertColumnSet documentation to understand column list inference for inserts.

func (*UserProvider) InsertG

func (o *UserProvider) InsertG(columns boil.Columns) error

InsertG a single record. See Insert for whitelist behavior description.

func (*UserProvider) Reload

func (o *UserProvider) Reload(exec boil.Executor) error

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

func (*UserProvider) ReloadG

func (o *UserProvider) ReloadG() error

ReloadG refetches the object from the database using the primary keys.

func (*UserProvider) SetUser

func (o *UserProvider) SetUser(exec boil.Executor, insert bool, related *User) error

SetUser of the userProvider to the related item. Sets o.R.User to related. Adds o to related.R.UserProviders.

func (*UserProvider) SetUserG

func (o *UserProvider) SetUserG(insert bool, related *User) error

SetUserG of the userProvider to the related item. Sets o.R.User to related. Adds o to related.R.UserProviders. Uses the global database handle.

func (*UserProvider) Update

func (o *UserProvider) Update(exec boil.Executor, columns boil.Columns) (int64, error)

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

func (o *UserProvider) UpdateG(columns boil.Columns) (int64, error)

UpdateG a single UserProvider record using the global executor. See Update for more documentation.

func (*UserProvider) Upsert

func (o *UserProvider) Upsert(exec boil.Executor, 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.

func (*UserProvider) UpsertG

func (o *UserProvider) UpsertG(updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error

UpsertG attempts an insert, and does an update or ignore on conflict.

func (*UserProvider) User

func (o *UserProvider) User(mods ...qm.QueryMod) userQuery

User pointed to by the foreign key.

type UserProviderHook

type UserProviderHook func(boil.Executor, *UserProvider) error

UserProviderHook is the signature for custom UserProvider hook methods

type UserProviderSlice

type UserProviderSlice []*UserProvider

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

func (UserProviderSlice) DeleteAll

func (o UserProviderSlice) DeleteAll(exec boil.Executor) (int64, error)

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

func (UserProviderSlice) DeleteAllG

func (o UserProviderSlice) DeleteAllG() (int64, error)

DeleteAllG deletes all rows in the slice.

func (*UserProviderSlice) ReloadAll

func (o *UserProviderSlice) ReloadAll(exec boil.Executor) error

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

func (*UserProviderSlice) ReloadAllG

func (o *UserProviderSlice) ReloadAllG() error

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

func (UserProviderSlice) UpdateAll

func (o UserProviderSlice) UpdateAll(exec boil.Executor, cols M) (int64, error)

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

func (UserProviderSlice) UpdateAllG

func (o UserProviderSlice) UpdateAllG(cols M) (int64, error)

UpdateAllG updates all rows with the specified column values.

type UserSlice

type UserSlice []*User

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

func (UserSlice) DeleteAll

func (o UserSlice) DeleteAll(exec boil.Executor) (int64, error)

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

func (UserSlice) DeleteAllG

func (o UserSlice) DeleteAllG() (int64, error)

DeleteAllG deletes all rows in the slice.

func (*UserSlice) ReloadAll

func (o *UserSlice) ReloadAll(exec boil.Executor) error

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

func (*UserSlice) ReloadAllG

func (o *UserSlice) ReloadAllG() error

ReloadAllG 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(exec boil.Executor, cols M) (int64, error)

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

func (UserSlice) UpdateAllG

func (o UserSlice) UpdateAllG(cols M) (int64, error)

UpdateAllG updates all rows with the specified column values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL