models

package
v0.0.0-...-706d53e Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ActorColumns = struct {
	ID        string
	URL       string
	PublicKey string
}{
	ID:        "id",
	URL:       "url",
	PublicKey: "public_key",
}
View Source
var ActorRels = struct {
	Users string
}{
	Users: "Users",
}

ActorRels is where relationship names are stored.

View Source
var ActorTableColumns = struct {
	ID        string
	URL       string
	PublicKey string
}{
	ID:        "actors.id",
	URL:       "actors.url",
	PublicKey: "actors.public_key",
}
View Source
var ActorWhere = struct {
	ID        whereHelperstring
	URL       whereHelperstring
	PublicKey whereHelper__byte
}{
	ID:        whereHelperstring{/* contains filtered or unexported fields */},
	URL:       whereHelperstring{/* contains filtered or unexported fields */},
	PublicKey: whereHelper__byte{/* contains filtered or unexported fields */},
}
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 {
	Actors    string
	Followers string
	Users     string
}{
	Actors:    "actors",
	Followers: "followers",
	Users:     "users",
}
View Source
var UserColumns = struct {
	Username   string
	ID         string
	PrivateKey string
	CreatedAt  string
}{
	Username:   "username",
	ID:         "id",
	PrivateKey: "private_key",
	CreatedAt:  "created_at",
}
View Source
var UserRels = struct {
	Actors string
}{
	Actors: "Actors",
}

UserRels is where relationship names are stored.

View Source
var UserTableColumns = struct {
	Username   string
	ID         string
	PrivateKey string
	CreatedAt  string
}{
	Username:   "users.username",
	ID:         "users.id",
	PrivateKey: "users.private_key",
	CreatedAt:  "users.created_at",
}
View Source
var UserWhere = struct {
	Username   whereHelperstring
	ID         whereHelperstring
	PrivateKey whereHelper__byte
	CreatedAt  whereHelpertime_Time
}{
	Username:   whereHelperstring{/* contains filtered or unexported fields */},
	ID:         whereHelperstring{/* contains filtered or unexported fields */},
	PrivateKey: whereHelper__byte{/* contains filtered or unexported fields */},
	CreatedAt:  whereHelpertime_Time{/* contains filtered or unexported fields */},
}
View Source
var ViewNames = struct {
}{}

Functions

func ActorExists

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

ActorExists checks if the Actor row exists.

func Actors

func Actors(mods ...qm.QueryMod) actorQuery

Actors retrieves all the records using an executor.

func AddActorHook

func AddActorHook(hookPoint boil.HookPoint, actorHook ActorHook)

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

func UserExists(ctx context.Context, exec boil.ContextExecutor, username 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 Actor

type Actor struct {
	ID        string `boil:"id" json:"id" toml:"id" yaml:"id"`
	URL       string `boil:"url" json:"url" toml:"url" yaml:"url"`
	PublicKey []byte `boil:"public_key" json:"public_key" toml:"public_key" yaml:"public_key"`

	R *actorR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L actorL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Actor is an object representing the database table.

func FindActor

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

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

func (*Actor) AddUsers

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

AddUsers adds the given related objects to the existing relationships of the actor, optionally inserting them as new records. Appends related to o.R.Users. Sets related.R.Actors appropriately.

func (*Actor) Delete

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

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

func (*Actor) Insert

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

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

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

func (*Actor) RemoveUsers

func (o *Actor) RemoveUsers(ctx context.Context, exec boil.ContextExecutor, related ...*User) error

RemoveUsers relationships from objects passed in. Removes related items from R.Users (uses pointer comparison, removal does not keep order) Sets related.R.Actors.

func (*Actor) SetUsers

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

SetUsers removes all previously related items of the actor replacing them completely with the passed in related items, optionally inserting them as new records. Sets o.R.Actors's Users accordingly. Replaces o.R.Users with related. Sets related.R.Actors's Users accordingly.

func (*Actor) Update

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

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

func (o *Actor) 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 (*Actor) Users

func (o *Actor) Users(mods ...qm.QueryMod) userQuery

Users retrieves all the user's Users with an executor.

type ActorHook

type ActorHook func(context.Context, boil.ContextExecutor, *Actor) error

ActorHook is the signature for custom Actor hook methods

type ActorSlice

type ActorSlice []*Actor

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

func (ActorSlice) DeleteAll

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

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

func (*ActorSlice) ReloadAll

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

func (o ActorSlice) 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 {
	Username   string    `boil:"username" json:"username" toml:"username" yaml:"username"`
	ID         string    `boil:"id" json:"id" toml:"id" yaml:"id"`
	PrivateKey []byte    `boil:"private_key" json:"private_key" toml:"private_key" yaml:"private_key"`
	CreatedAt  time.Time `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_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, username 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) Actors

func (o *User) Actors(mods ...qm.QueryMod) actorQuery

Actors retrieves all the actor's Actors with an executor.

func (*User) AddActors

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

AddActors adds the given related objects to the existing relationships of the user, optionally inserting them as new records. Appends related to o.R.Actors. Sets related.R.Users 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) RemoveActors

func (o *User) RemoveActors(ctx context.Context, exec boil.ContextExecutor, related ...*Actor) error

RemoveActors relationships from objects passed in. Removes related items from R.Actors (uses pointer comparison, removal does not keep order) Sets related.R.Users.

func (*User) SetActors

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

SetActors removes all previously related items of the user replacing them completely with the passed in related items, optionally inserting them as new records. Sets o.R.Users's Actors accordingly. Replaces o.R.Actors with related. Sets related.R.Users's Actors accordingly.

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