models

package
v0.0.0-...-5ac1aa0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: AGPL-3.0 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 GorpMigrationColumns = struct {
	ID        string
	AppliedAt string
}{
	ID:        "id",
	AppliedAt: "applied_at",
}
View Source
var GorpMigrationRels = struct {
}{}

GorpMigrationRels is where relationship names are stored.

View Source
var GorpMigrationTableColumns = struct {
	ID        string
	AppliedAt string
}{
	ID:        "gorp_migrations.id",
	AppliedAt: "gorp_migrations.applied_at",
}
View Source
var GorpMigrationWhere = struct {
	ID        whereHelperstring
	AppliedAt whereHelpernull_Time
}{
	ID:        whereHelperstring{/* contains filtered or unexported fields */},
	AppliedAt: whereHelpernull_Time{/* contains filtered or unexported fields */},
}
View Source
var PostColumns = struct {
	ID      string
	UserID  string
	Content string
}{
	ID:      "id",
	UserID:  "user_id",
	Content: "content",
}
View Source
var PostRels = struct {
	User string
}{
	User: "User",
}

PostRels is where relationship names are stored.

View Source
var PostTableColumns = struct {
	ID      string
	UserID  string
	Content string
}{
	ID:      "posts.id",
	UserID:  "posts.user_id",
	Content: "posts.content",
}
View Source
var PostWhere = struct {
	ID      whereHelperstring
	UserID  whereHelperstring
	Content whereHelperstring
}{
	ID:      whereHelperstring{/* contains filtered or unexported fields */},
	UserID:  whereHelperstring{/* contains filtered or unexported fields */},
	Content: whereHelperstring{/* contains filtered or unexported fields */},
}
View Source
var TableNames = struct {
	GorpMigrations string
	Posts          string
	Tokens         string
	Users          string
}{
	GorpMigrations: "gorp_migrations",
	Posts:          "posts",
	Tokens:         "tokens",
	Users:          "users",
}
View Source
var TokenColumns = struct {
	ID       string
	UserID   string
	ReadOnly string
	Invalid  string
	Created  string
	Expires  string
}{
	ID:       "id",
	UserID:   "user_id",
	ReadOnly: "read_only",
	Invalid:  "invalid",
	Created:  "created",
	Expires:  "expires",
}
View Source
var TokenRels = struct {
	User string
}{
	User: "User",
}

TokenRels is where relationship names are stored.

View Source
var TokenTableColumns = struct {
	ID       string
	UserID   string
	ReadOnly string
	Invalid  string
	Created  string
	Expires  string
}{
	ID:       "tokens.id",
	UserID:   "tokens.user_id",
	ReadOnly: "tokens.read_only",
	Invalid:  "tokens.invalid",
	Created:  "tokens.created",
	Expires:  "tokens.expires",
}
View Source
var TokenWhere = struct {
	ID       whereHelperstring
	UserID   whereHelperstring
	ReadOnly whereHelperbool
	Invalid  whereHelperbool
	Created  whereHelpertime_Time
	Expires  whereHelpertime_Time
}{
	ID:       whereHelperstring{/* contains filtered or unexported fields */},
	UserID:   whereHelperstring{/* contains filtered or unexported fields */},
	ReadOnly: whereHelperbool{/* contains filtered or unexported fields */},
	Invalid:  whereHelperbool{/* contains filtered or unexported fields */},
	Created:  whereHelpertime_Time{/* contains filtered or unexported fields */},
	Expires:  whereHelpertime_Time{/* contains filtered or unexported fields */},
}
View Source
var UserColumns = struct {
	ID             string
	Username       string
	Email          string
	Password       string
	External       string
	Bio            string
	Pronouns       string
	ProfilePicture string
	IsAdmin        string
	Created        string
}{
	ID:             "id",
	Username:       "username",
	Email:          "email",
	Password:       "password",
	External:       "external",
	Bio:            "bio",
	Pronouns:       "pronouns",
	ProfilePicture: "profile_picture",
	IsAdmin:        "is_admin",
	Created:        "created",
}
View Source
var UserRels = struct {
	Posts  string
	Tokens string
}{
	Posts:  "Posts",
	Tokens: "Tokens",
}

UserRels is where relationship names are stored.

View Source
var UserTableColumns = struct {
	ID             string
	Username       string
	Email          string
	Password       string
	External       string
	Bio            string
	Pronouns       string
	ProfilePicture string
	IsAdmin        string
	Created        string
}{
	ID:             "users.id",
	Username:       "users.username",
	Email:          "users.email",
	Password:       "users.password",
	External:       "users.external",
	Bio:            "users.bio",
	Pronouns:       "users.pronouns",
	ProfilePicture: "users.profile_picture",
	IsAdmin:        "users.is_admin",
	Created:        "users.created",
}
View Source
var UserWhere = struct {
	ID             whereHelperstring
	Username       whereHelperstring
	Email          whereHelpernull_String
	Password       whereHelpernull_String
	External       whereHelperbool
	Bio            whereHelpernull_String
	Pronouns       whereHelpernull_String
	ProfilePicture whereHelpernull_String
	IsAdmin        whereHelperbool
	Created        whereHelpertime_Time
}{
	ID:             whereHelperstring{/* contains filtered or unexported fields */},
	Username:       whereHelperstring{/* contains filtered or unexported fields */},
	Email:          whereHelpernull_String{/* contains filtered or unexported fields */},
	Password:       whereHelpernull_String{/* contains filtered or unexported fields */},
	External:       whereHelperbool{/* contains filtered or unexported fields */},
	Bio:            whereHelpernull_String{/* contains filtered or unexported fields */},
	Pronouns:       whereHelpernull_String{/* contains filtered or unexported fields */},
	ProfilePicture: whereHelpernull_String{/* contains filtered or unexported fields */},
	IsAdmin:        whereHelperbool{/* contains filtered or unexported fields */},
	Created:        whereHelpertime_Time{/* contains filtered or unexported fields */},
}
View Source
var ViewNames = struct {
}{}

Functions

func AddGorpMigrationHook

func AddGorpMigrationHook(hookPoint boil.HookPoint, gorpMigrationHook GorpMigrationHook)

AddGorpMigrationHook registers your hook function for all future operations.

func AddPostHook

func AddPostHook(hookPoint boil.HookPoint, postHook PostHook)

AddPostHook registers your hook function for all future operations.

func AddTokenHook

func AddTokenHook(hookPoint boil.HookPoint, tokenHook TokenHook)

AddTokenHook 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 GorpMigrationExists

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

GorpMigrationExists checks if the GorpMigration row exists.

func GorpMigrations

func GorpMigrations(mods ...qm.QueryMod) gorpMigrationQuery

GorpMigrations 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 PostExists

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

PostExists checks if the Post row exists.

func Posts

func Posts(mods ...qm.QueryMod) postQuery

Posts retrieves all the records using an executor.

func TokenExists

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

TokenExists checks if the Token row exists.

func Tokens

func Tokens(mods ...qm.QueryMod) tokenQuery

Tokens 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 GorpMigration

type GorpMigration struct {
	ID        string    `boil:"id" json:"id" toml:"id" yaml:"id"`
	AppliedAt null.Time `boil:"applied_at" json:"applied_at,omitempty" toml:"applied_at" yaml:"applied_at,omitempty"`

	R *gorpMigrationR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L gorpMigrationL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

GorpMigration is an object representing the database table.

func FindGorpMigration

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

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

func (*GorpMigration) Delete

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

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

func (*GorpMigration) Exists

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

Exists checks if the GorpMigration row exists.

func (*GorpMigration) Insert

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

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

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

func (*GorpMigration) Update

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

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

func (o *GorpMigration) 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 GorpMigrationHook

type GorpMigrationHook func(context.Context, boil.ContextExecutor, *GorpMigration) error

GorpMigrationHook is the signature for custom GorpMigration hook methods

type GorpMigrationSlice

type GorpMigrationSlice []*GorpMigration

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

func (GorpMigrationSlice) DeleteAll

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

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

func (*GorpMigrationSlice) ReloadAll

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

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

type Post 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"`
	Content string `boil:"content" json:"content" toml:"content" yaml:"content"`

	R *postR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L postL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Post is an object representing the database table.

func FindPost

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

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

func (*Post) Delete

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

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

func (*Post) Exists

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

Exists checks if the Post row exists.

func (*Post) Insert

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

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

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

func (*Post) SetUser

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

SetUser of the post to the related item. Sets o.R.User to related. Adds o to related.R.Posts.

func (*Post) Update

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

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

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

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

User pointed to by the foreign key.

type PostHook

type PostHook func(context.Context, boil.ContextExecutor, *Post) error

PostHook is the signature for custom Post hook methods

type PostSlice

type PostSlice []*Post

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

func (PostSlice) DeleteAll

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

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

func (*PostSlice) ReloadAll

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

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

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

type Token

type Token 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"`
	ReadOnly bool      `boil:"read_only" json:"read_only" toml:"read_only" yaml:"read_only"`
	Invalid  bool      `boil:"invalid" json:"invalid" toml:"invalid" yaml:"invalid"`
	Created  time.Time `boil:"created" json:"created" toml:"created" yaml:"created"`
	Expires  time.Time `boil:"expires" json:"expires" toml:"expires" yaml:"expires"`

	R *tokenR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L tokenL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Token is an object representing the database table.

func FindToken

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

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

func (*Token) Delete

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

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

func (*Token) Exists

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

Exists checks if the Token row exists.

func (*Token) Insert

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

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

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

func (*Token) SetUser

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

SetUser of the token to the related item. Sets o.R.User to related. Adds o to related.R.Tokens.

func (*Token) Update

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

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

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

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

User pointed to by the foreign key.

type TokenHook

type TokenHook func(context.Context, boil.ContextExecutor, *Token) error

TokenHook is the signature for custom Token hook methods

type TokenSlice

type TokenSlice []*Token

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

func (TokenSlice) DeleteAll

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

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

func (*TokenSlice) ReloadAll

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

func (o TokenSlice) 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"`
	Username       string      `boil:"username" json:"username" toml:"username" yaml:"username"`
	Email          null.String `boil:"email" json:"email,omitempty" toml:"email" yaml:"email,omitempty"`
	Password       null.String `boil:"password" json:"password,omitempty" toml:"password" yaml:"password,omitempty"`
	External       bool        `boil:"external" json:"external" toml:"external" yaml:"external"`
	Bio            null.String `boil:"bio" json:"bio,omitempty" toml:"bio" yaml:"bio,omitempty"`
	Pronouns       null.String `boil:"pronouns" json:"pronouns,omitempty" toml:"pronouns" yaml:"pronouns,omitempty"`
	ProfilePicture null.String `boil:"profile_picture" json:"profile_picture,omitempty" toml:"profile_picture" yaml:"profile_picture,omitempty"`
	IsAdmin        bool        `boil:"is_admin" json:"is_admin" toml:"is_admin" yaml:"is_admin"`
	Created        time.Time   `boil:"created" json:"created" toml:"created" yaml:"created"`

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

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

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

func (*User) AddTokens

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

AddTokens adds the given related objects to the existing relationships of the user, optionally inserting them as new records. Appends related to o.R.Tokens. 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) 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) Posts

func (o *User) Posts(mods ...qm.QueryMod) postQuery

Posts retrieves all the post's Posts with an executor.

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

func (o *User) Tokens(mods ...qm.QueryMod) tokenQuery

Tokens retrieves all the token's Tokens 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