postgres

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserStatusNew     = "new"
	UserStatusActive  = "active"
	UserStatusBlocked = "blocked"
)

Enum values for user_status

View Source
const (
	UserRoleOwner = "owner"
	UserRoleRoot  = "root"
	UserRoleUser  = "user"
)

Enum values for user_role

View Source
const (
	TokenTypeAuth = "auth"
)

Enum values for token_type

Variables

View Source
var AuthTokenColumns = struct {
	ID        string
	UserID    string
	Token     string
	Type      string
	DTExpired string
	DTCreated string
}{
	ID:        "id",
	UserID:    "user_id",
	Token:     "token",
	Type:      "type",
	DTExpired: "dt_expired",
	DTCreated: "dt_created",
}
View Source
var AuthTokenRels = struct {
	User string
}{
	User: "User",
}

AuthTokenRels is where relationship names are stored.

View Source
var AuthTokenWhere = struct {
	ID        whereHelperint64
	UserID    whereHelperint64
	Token     whereHelperstring
	Type      whereHelperstring
	DTExpired whereHelpertime_Time
	DTCreated whereHelpertime_Time
}{
	ID:        whereHelperint64{/* contains filtered or unexported fields */},
	UserID:    whereHelperint64{/* contains filtered or unexported fields */},
	Token:     whereHelperstring{/* contains filtered or unexported fields */},
	Type:      whereHelperstring{/* contains filtered or unexported fields */},
	DTExpired: whereHelpertime_Time{/* contains filtered or unexported fields */},
	DTCreated: whereHelpertime_Time{/* contains filtered or unexported fields */},
}
View Source
var ErrSyncFail = errors.New("postgres: 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 {
	AuthToken string
	User      string
}{
	AuthToken: "auth_token",
	User:      "user",
}
View Source
var UserColumns = struct {
	ID           string
	Login        string
	Password     string
	Status       string
	Name         string
	Role         string
	DTCreated    string
	DTUpdated    string
	DTLastLogged string
}{
	ID:           "id",
	Login:        "login",
	Password:     "password",
	Status:       "status",
	Name:         "name",
	Role:         "role",
	DTCreated:    "dt_created",
	DTUpdated:    "dt_updated",
	DTLastLogged: "dt_last_logged",
}
View Source
var UserRels = struct {
	AuthTokens string
}{
	AuthTokens: "AuthTokens",
}

UserRels is where relationship names are stored.

View Source
var UserWhere = struct {
	ID           whereHelperint64
	Login        whereHelperstring
	Password     whereHelperstring
	Status       whereHelperstring
	Name         whereHelperstring
	Role         whereHelperstring
	DTCreated    whereHelpertime_Time
	DTUpdated    whereHelpertime_Time
	DTLastLogged whereHelpertime_Time
}{
	ID:           whereHelperint64{/* contains filtered or unexported fields */},
	Login:        whereHelperstring{/* contains filtered or unexported fields */},
	Password:     whereHelperstring{/* contains filtered or unexported fields */},
	Status:       whereHelperstring{/* contains filtered or unexported fields */},
	Name:         whereHelperstring{/* contains filtered or unexported fields */},
	Role:         whereHelperstring{/* contains filtered or unexported fields */},
	DTCreated:    whereHelpertime_Time{/* contains filtered or unexported fields */},
	DTUpdated:    whereHelpertime_Time{/* contains filtered or unexported fields */},
	DTLastLogged: whereHelpertime_Time{/* contains filtered or unexported fields */},
}

Functions

func AddAuthTokenHook

func AddAuthTokenHook(hookPoint boil.HookPoint, authTokenHook AuthTokenHook)

AddAuthTokenHook 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 AuthTokenExists

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

AuthTokenExists checks if the AuthToken row exists.

func AuthTokens

func AuthTokens(mods ...qm.QueryMod) authTokenQuery

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

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

type AuthToken struct {
	ID        int64     `boil:"id" json:"id" toml:"id" yaml:"id"`
	UserID    int64     `boil:"user_id" json:"user_id" toml:"user_id" yaml:"user_id"`
	Token     string    `boil:"token" json:"token" toml:"token" yaml:"token"`
	Type      string    `boil:"type" json:"type" toml:"type" yaml:"type"`
	DTExpired time.Time `boil:"dt_expired" json:"dt_expired" toml:"dt_expired" yaml:"dt_expired"`
	DTCreated time.Time `boil:"dt_created" json:"dt_created" toml:"dt_created" yaml:"dt_created"`

	R *authTokenR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L authTokenL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

AuthToken is an object representing the database table.

func FindAuthToken

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

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

func (*AuthToken) Delete

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

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

func (*AuthToken) Insert

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

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

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

func (*AuthToken) SetUser

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

SetUser of the authToken to the related item. Sets o.R.User to related. Adds o to related.R.AuthTokens.

func (*AuthToken) Update

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

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

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

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

User pointed to by the foreign key.

type AuthTokenHook

type AuthTokenHook func(context.Context, boil.ContextExecutor, *AuthToken) error

AuthTokenHook is the signature for custom AuthToken hook methods

type AuthTokenSlice

type AuthTokenSlice []*AuthToken

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

func (AuthTokenSlice) DeleteAll

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

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

func (*AuthTokenSlice) ReloadAll

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

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

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

type M

type M map[string]interface{}

M type is for providing columns and column values to UpdateAll.

type User

type User struct {
	ID           int64     `boil:"id" json:"id" toml:"id" yaml:"id"`
	Login        string    `boil:"login" json:"login" toml:"login" yaml:"login"`
	Password     string    `boil:"password" json:"password" toml:"password" yaml:"password"`
	Status       string    `boil:"status" json:"status" toml:"status" yaml:"status"`
	Name         string    `boil:"name" json:"name" toml:"name" yaml:"name"`
	Role         string    `boil:"role" json:"role" toml:"role" yaml:"role"`
	DTCreated    time.Time `boil:"dt_created" json:"dt_created" toml:"dt_created" yaml:"dt_created"`
	DTUpdated    time.Time `boil:"dt_updated" json:"dt_updated" toml:"dt_updated" yaml:"dt_updated"`
	DTLastLogged time.Time `boil:"dt_last_logged" json:"dt_last_logged" toml:"dt_last_logged" yaml:"dt_last_logged"`

	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 int64, 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) AddAuthTokens

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

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

func (*User) AuthTokens

func (o *User) AuthTokens(mods ...qm.QueryMod) authTokenQuery

AuthTokens retrieves all the auth_token's AuthTokens with an executor.

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) 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 generally be used opposed to []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