models

package
v0.0.0-...-5491828 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: MIT 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 SessionColumns = struct {
	ID           string
	UserID       string
	AccessToken  string
	RefreshToken string
	EndedAt      string
	ExpiresAt    string
	CreatedAt    string
	UpdatedAt    string
}{
	ID:           "id",
	UserID:       "user_id",
	AccessToken:  "access_token",
	RefreshToken: "refresh_token",
	EndedAt:      "ended_at",
	ExpiresAt:    "expires_at",
	CreatedAt:    "created_at",
	UpdatedAt:    "updated_at",
}
View Source
var SessionRels = struct {
	User string
}{
	User: "User",
}

SessionRels is where relationship names are stored.

View Source
var SessionTableColumns = struct {
	ID           string
	UserID       string
	AccessToken  string
	RefreshToken string
	EndedAt      string
	ExpiresAt    string
	CreatedAt    string
	UpdatedAt    string
}{
	ID:           "sessions.id",
	UserID:       "sessions.user_id",
	AccessToken:  "sessions.access_token",
	RefreshToken: "sessions.refresh_token",
	EndedAt:      "sessions.ended_at",
	ExpiresAt:    "sessions.expires_at",
	CreatedAt:    "sessions.created_at",
	UpdatedAt:    "sessions.updated_at",
}
View Source
var SessionWhere = struct {
	ID           whereHelperstring
	UserID       whereHelperstring
	AccessToken  whereHelperstring
	RefreshToken whereHelperstring
	EndedAt      whereHelpernull_Time
	ExpiresAt    whereHelpertime_Time
	CreatedAt    whereHelpertime_Time
	UpdatedAt    whereHelpertime_Time
}{
	ID:           whereHelperstring{/* contains filtered or unexported fields */},
	UserID:       whereHelperstring{/* contains filtered or unexported fields */},
	AccessToken:  whereHelperstring{/* contains filtered or unexported fields */},
	RefreshToken: whereHelperstring{/* contains filtered or unexported fields */},
	EndedAt:      whereHelpernull_Time{/* contains filtered or unexported fields */},
	ExpiresAt:    whereHelpertime_Time{/* 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 {
	Sessions string
	Users    string
}{
	Sessions: "sessions",
	Users:    "users",
}
View Source
var UserColumns = struct {
	ID        string
	Name      string
	Email     string
	Hashword  string
	Active    string
	CreatedAt string
	UpdatedAt string
}{
	ID:        "id",
	Name:      "name",
	Email:     "email",
	Hashword:  "hashword",
	Active:    "active",
	CreatedAt: "created_at",
	UpdatedAt: "updated_at",
}
View Source
var UserRels = struct {
	Sessions string
}{
	Sessions: "Sessions",
}

UserRels is where relationship names are stored.

View Source
var UserTableColumns = struct {
	ID        string
	Name      string
	Email     string
	Hashword  string
	Active    string
	CreatedAt string
	UpdatedAt string
}{
	ID:        "users.id",
	Name:      "users.name",
	Email:     "users.email",
	Hashword:  "users.hashword",
	Active:    "users.active",
	CreatedAt: "users.created_at",
	UpdatedAt: "users.updated_at",
}
View Source
var UserWhere = struct {
	ID        whereHelperstring
	Name      whereHelperstring
	Email     whereHelperstring
	Hashword  whereHelper__byte
	Active    whereHelperbool
	CreatedAt whereHelpertime_Time
	UpdatedAt whereHelpertime_Time
}{
	ID:        whereHelperstring{/* contains filtered or unexported fields */},
	Name:      whereHelperstring{/* contains filtered or unexported fields */},
	Email:     whereHelperstring{/* contains filtered or unexported fields */},
	Hashword:  whereHelper__byte{/* contains filtered or unexported fields */},
	Active:    whereHelperbool{/* contains filtered or unexported fields */},
	CreatedAt: whereHelpertime_Time{/* contains filtered or unexported fields */},
	UpdatedAt: whereHelpertime_Time{/* contains filtered or unexported fields */},
}

Functions

func AddSessionHook

func AddSessionHook(hookPoint boil.HookPoint, sessionHook SessionHook)

AddSessionHook 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 SessionExists

func SessionExists(ctx context.Context, exec boil.ContextExecutor, iD string) (bool, error)

SessionExists checks if the Session row exists.

func Sessions

func Sessions(mods ...qm.QueryMod) sessionQuery

Sessions retrieves all the records using an executor.

func UserExists

func UserExists(ctx context.Context, exec boil.ContextExecutor, iD string) (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 Session

type Session struct {
	ID           string    `boil:"id" json:"id" toml:"id" yaml:"id"`
	UserID       string    `boil:"user_id" json:"user_id" toml:"user_id" yaml:"user_id"`
	AccessToken  string    `boil:"access_token" json:"access_token" toml:"access_token" yaml:"access_token"`
	RefreshToken string    `boil:"refresh_token" json:"refresh_token" toml:"refresh_token" yaml:"refresh_token"`
	EndedAt      null.Time `boil:"ended_at" json:"ended_at,omitempty" toml:"ended_at" yaml:"ended_at,omitempty"`
	ExpiresAt    time.Time `boil:"expires_at" json:"expires_at" toml:"expires_at" yaml:"expires_at"`
	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 *sessionR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L sessionL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Session is an object representing the database table.

func FindSession

func FindSession(ctx context.Context, exec boil.ContextExecutor, iD string, selectCols ...string) (*Session, error)

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

func (*Session) Delete

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

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

func (*Session) Insert

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

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

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

func (*Session) SetUser

func (o *Session) SetUser(ctx context.Context, exec boil.ContextExecutor, insert bool, related *User) error

SetUser of the session to the related item. Sets o.R.User to related. Adds o to related.R.Sessions.

func (*Session) Update

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

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

func (o *Session) 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.

func (*Session) User

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

User pointed to by the foreign key.

type SessionHook

type SessionHook func(context.Context, boil.ContextExecutor, *Session) error

SessionHook is the signature for custom Session hook methods

type SessionSlice

type SessionSlice []*Session

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

func (SessionSlice) DeleteAll

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

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

func (*SessionSlice) ReloadAll

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

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

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

type User

type User struct {
	ID        string    `boil:"id" json:"id" toml:"id" yaml:"id"`
	Name      string    `boil:"name" json:"name" toml:"name" yaml:"name"`
	Email     string    `boil:"email" json:"email" toml:"email" yaml:"email"`
	Hashword  []byte    `boil:"hashword" json:"hashword" toml:"hashword" yaml:"hashword"`
	Active    bool      `boil:"active" json:"active" toml:"active" yaml:"active"`
	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 *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 string, 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) AddSessions

func (o *User) AddSessions(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*Session) error

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

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) 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) Sessions

func (o *User) Sessions(mods ...qm.QueryMod) sessionQuery

Sessions retrieves all the session's Sessions 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) 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
⌂ 换网址