Documentation
¶
Index ¶
- Variables
- func CredentialExists(ctx context.Context, exec bob.Executor, CredIDPK string) (bool, error)
- func FileExists(ctx context.Context, exec bob.Executor, IDPK int32) (bool, error)
- func ItemExists(ctx context.Context, exec bob.Executor, IDPK int32) (bool, error)
- func SchemaMigrationExists(ctx context.Context, exec bob.Executor, VersionPK string) (bool, error)
- func UserExists(ctx context.Context, exec bob.Executor, IDPK int32) (bool, error)
- func Where[Q sqlite.Filterable]() struct{ ... }
- type Credential
- func (o *Credential) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
- func (credential0 *Credential) AttachUser(ctx context.Context, exec bob.Executor, user1 *User) error
- func (o *Credential) Delete(ctx context.Context, exec bob.Executor) error
- func (credential0 *Credential) InsertUser(ctx context.Context, exec bob.Executor, related *UserSetter) error
- func (o *Credential) LoadUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
- func (o *Credential) Preload(name string, retrieved any) error
- func (o *Credential) Reload(ctx context.Context, exec bob.Executor) error
- func (o *Credential) Update(ctx context.Context, exec bob.Executor, s *CredentialSetter) error
- func (o *Credential) User(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery
- type CredentialSetter
- type CredentialSlice
- func (o CredentialSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
- func (o CredentialSlice) DeleteAll(ctx context.Context, exec bob.Executor) error
- func (o CredentialSlice) DeleteMod() bob.Mod[*dialect.DeleteQuery]
- func (os CredentialSlice) LoadUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
- func (o CredentialSlice) ReloadAll(ctx context.Context, exec bob.Executor) error
- func (o CredentialSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals CredentialSetter) error
- func (o CredentialSlice) UpdateMod() bob.Mod[*dialect.UpdateQuery]
- func (os CredentialSlice) User(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery
- type CredentialsQuery
- type File
- func (o *File) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
- func (file0 *File) AttachProfilePictureUsers(ctx context.Context, exec bob.Executor, related ...*User) error
- func (file0 *File) AttachUser(ctx context.Context, exec bob.Executor, user1 *User) error
- func (o *File) Delete(ctx context.Context, exec bob.Executor) error
- func (file0 *File) InsertProfilePictureUsers(ctx context.Context, exec bob.Executor, related ...*UserSetter) error
- func (file0 *File) InsertUser(ctx context.Context, exec bob.Executor, related *UserSetter) error
- func (o *File) LoadProfilePictureUsers(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
- func (o *File) LoadUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
- func (o *File) Preload(name string, retrieved any) error
- func (o *File) ProfilePictureUsers(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery
- func (o *File) Reload(ctx context.Context, exec bob.Executor) error
- func (o *File) Update(ctx context.Context, exec bob.Executor, s *FileSetter) error
- func (o *File) User(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery
- type FileSetter
- type FileSlice
- func (o FileSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
- func (o FileSlice) DeleteAll(ctx context.Context, exec bob.Executor) error
- func (o FileSlice) DeleteMod() bob.Mod[*dialect.DeleteQuery]
- func (os FileSlice) LoadProfilePictureUsers(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
- func (os FileSlice) LoadUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
- func (os FileSlice) ProfilePictureUsers(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery
- func (o FileSlice) ReloadAll(ctx context.Context, exec bob.Executor) error
- func (o FileSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FileSetter) error
- func (o FileSlice) UpdateMod() bob.Mod[*dialect.UpdateQuery]
- func (os FileSlice) User(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery
- type FilesQuery
- type Item
- func (o *Item) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
- func (item0 *Item) AttachUser(ctx context.Context, exec bob.Executor, user1 *User) error
- func (o *Item) Delete(ctx context.Context, exec bob.Executor) error
- func (item0 *Item) InsertUser(ctx context.Context, exec bob.Executor, related *UserSetter) error
- func (o *Item) LoadUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
- func (o *Item) Preload(name string, retrieved any) error
- func (o *Item) Reload(ctx context.Context, exec bob.Executor) error
- func (o *Item) Update(ctx context.Context, exec bob.Executor, s *ItemSetter) error
- func (o *Item) User(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery
- type ItemSetter
- type ItemSlice
- func (o ItemSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
- func (o ItemSlice) DeleteAll(ctx context.Context, exec bob.Executor) error
- func (o ItemSlice) DeleteMod() bob.Mod[*dialect.DeleteQuery]
- func (os ItemSlice) LoadUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
- func (o ItemSlice) ReloadAll(ctx context.Context, exec bob.Executor) error
- func (o ItemSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals ItemSetter) error
- func (o ItemSlice) UpdateMod() bob.Mod[*dialect.UpdateQuery]
- func (os ItemSlice) User(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery
- type ItemsQuery
- type SchemaMigration
- func (o *SchemaMigration) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
- func (o *SchemaMigration) Delete(ctx context.Context, exec bob.Executor) error
- func (o *SchemaMigration) Reload(ctx context.Context, exec bob.Executor) error
- func (o *SchemaMigration) Update(ctx context.Context, exec bob.Executor, s *SchemaMigrationSetter) error
- type SchemaMigrationSetter
- func (s *SchemaMigrationSetter) Apply(q *dialect.InsertQuery)
- func (s SchemaMigrationSetter) Expressions(prefix ...string) []bob.Expression
- func (s SchemaMigrationSetter) Overwrite(t *SchemaMigration)
- func (s SchemaMigrationSetter) SetColumns() []string
- func (s SchemaMigrationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery]
- type SchemaMigrationSlice
- func (o SchemaMigrationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
- func (o SchemaMigrationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error
- func (o SchemaMigrationSlice) DeleteMod() bob.Mod[*dialect.DeleteQuery]
- func (o SchemaMigrationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error
- func (o SchemaMigrationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals SchemaMigrationSetter) error
- func (o SchemaMigrationSlice) UpdateMod() bob.Mod[*dialect.UpdateQuery]
- type SchemaMigrationsQuery
- type UniqueConstraintError
- type User
- func (o *User) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
- func (user0 *User) AttachCredentials(ctx context.Context, exec bob.Executor, related ...*Credential) error
- func (user0 *User) AttachFiles(ctx context.Context, exec bob.Executor, related ...*File) error
- func (user0 *User) AttachItems(ctx context.Context, exec bob.Executor, related ...*Item) error
- func (user0 *User) AttachProfilePictureFile(ctx context.Context, exec bob.Executor, file1 *File) error
- func (o *User) Credentials(mods ...bob.Mod[*dialect.SelectQuery]) CredentialsQuery
- func (o *User) Delete(ctx context.Context, exec bob.Executor) error
- func (o *User) Files(mods ...bob.Mod[*dialect.SelectQuery]) FilesQuery
- func (user0 *User) InsertCredentials(ctx context.Context, exec bob.Executor, related ...*CredentialSetter) error
- func (user0 *User) InsertFiles(ctx context.Context, exec bob.Executor, related ...*FileSetter) error
- func (user0 *User) InsertItems(ctx context.Context, exec bob.Executor, related ...*ItemSetter) error
- func (user0 *User) InsertProfilePictureFile(ctx context.Context, exec bob.Executor, related *FileSetter) error
- func (o *User) Items(mods ...bob.Mod[*dialect.SelectQuery]) ItemsQuery
- func (o *User) LoadCredentials(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
- func (o *User) LoadFiles(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
- func (o *User) LoadItems(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
- func (o *User) LoadProfilePictureFile(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
- func (o *User) Preload(name string, retrieved any) error
- func (o *User) ProfilePictureFile(mods ...bob.Mod[*dialect.SelectQuery]) FilesQuery
- func (o *User) Reload(ctx context.Context, exec bob.Executor) error
- func (o *User) Update(ctx context.Context, exec bob.Executor, s *UserSetter) error
- type UserSetter
- type UserSlice
- func (o UserSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
- func (os UserSlice) Credentials(mods ...bob.Mod[*dialect.SelectQuery]) CredentialsQuery
- func (o UserSlice) DeleteAll(ctx context.Context, exec bob.Executor) error
- func (o UserSlice) DeleteMod() bob.Mod[*dialect.DeleteQuery]
- func (os UserSlice) Files(mods ...bob.Mod[*dialect.SelectQuery]) FilesQuery
- func (os UserSlice) Items(mods ...bob.Mod[*dialect.SelectQuery]) ItemsQuery
- func (os UserSlice) LoadCredentials(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
- func (os UserSlice) LoadFiles(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
- func (os UserSlice) LoadItems(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
- func (os UserSlice) LoadProfilePictureFile(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
- func (os UserSlice) ProfilePictureFile(mods ...bob.Mod[*dialect.SelectQuery]) FilesQuery
- func (o UserSlice) ReloadAll(ctx context.Context, exec bob.Executor) error
- func (o UserSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals UserSetter) error
- func (o UserSlice) UpdateMod() bob.Mod[*dialect.UpdateQuery]
- type UsersQuery
Constants ¶
This section is empty.
Variables ¶
var ( SelectWhere = Where[*dialect.SelectQuery]() UpdateWhere = Where[*dialect.UpdateQuery]() DeleteWhere = Where[*dialect.DeleteQuery]() OnConflictWhere = Where[*clause.ConflictClause]() // Used in ON CONFLICT DO UPDATE )
var ( SelectThenLoad = getThenLoaders[*dialect.SelectQuery]() InsertThenLoad = getThenLoaders[*dialect.InsertQuery]() UpdateThenLoad = getThenLoaders[*dialect.UpdateQuery]() )
var ( SelectJoins = getJoins[*dialect.SelectQuery] UpdateJoins = getJoins[*dialect.UpdateQuery] )
var ColumnNames = struct {
Credentials credentialColumnNames
Files fileColumnNames
Items itemColumnNames
SchemaMigrations schemaMigrationColumnNames
Users userColumnNames
}{
Credentials: credentialColumnNames{
CredID: "cred_id",
CredPublicKey: "cred_public_key",
SignCount: "sign_count",
Transports: "transports",
UserVerified: "user_verified",
BackupEligible: "backup_eligible",
BackupState: "backup_state",
AttestationObject: "attestation_object",
AttestationClientData: "attestation_client_data",
CreatedAt: "created_at",
LastUsed: "last_used",
UserID: "user_id",
},
Files: fileColumnNames{
ID: "id",
Name: "name",
Data: "data",
UserID: "user_id",
},
Items: itemColumnNames{
ID: "id",
Name: "name",
Added: "added",
Description: "description",
Price: "price",
Quantity: "quantity",
UserID: "user_id",
},
SchemaMigrations: schemaMigrationColumnNames{
Version: "version",
},
Users: userColumnNames{
ID: "id",
Username: "username",
Password: "password",
ProfilePictureID: "profile_picture_id",
WebauthnID: "webauthn_id",
},
}
var CredentialColumns = buildCredentialColumns("credential")
var CredentialErrors = &credentialErrors{ ErrUniquePkMainCredential: &UniqueConstraintError{ schema: "", table: "credential", columns: []string{"cred_id"}, s: "pk_main_credential", }, }
var Credentials = sqlite.NewTablex[*Credential, CredentialSlice, *CredentialSetter]("", "credential")
Credentials contains methods to work with the credential table
var ErrUniqueConstraint = &UniqueConstraintError{s: ""}
ErrUniqueConstraint captures all unique constraint errors by explicitly leaving `s` empty.
var FileColumns = buildFileColumns("file")
var FileErrors = &fileErrors{ ErrUniquePkMainFile: &UniqueConstraintError{ schema: "", table: "file", columns: []string{"id"}, s: "pk_main_file", }, }
var Files = sqlite.NewTablex[*File, FileSlice, *FileSetter]("", "file")
Files contains methods to work with the file table
var ItemColumns = buildItemColumns("item")
var ItemErrors = &itemErrors{ ErrUniquePkMainItem: &UniqueConstraintError{ schema: "", table: "item", columns: []string{"id"}, s: "pk_main_item", }, }
var Items = sqlite.NewTablex[*Item, ItemSlice, *ItemSetter]("", "item")
Items contains methods to work with the item table
var Preload = getPreloaders()
var SchemaMigrationColumns = buildSchemaMigrationColumns("schema_migrations")
var SchemaMigrationErrors = &schemaMigrationErrors{ ErrUniquePkMainSchemaMigrations: &UniqueConstraintError{ schema: "", table: "schema_migrations", columns: []string{"version"}, s: "pk_main_schema_migrations", }, }
var SchemaMigrations = sqlite.NewTablex[*SchemaMigration, SchemaMigrationSlice, *SchemaMigrationSetter]("", "schema_migrations")
SchemaMigrations contains methods to work with the schema_migrations table
var TableNames = struct { Credentials string Files string Items string SchemaMigrations string Users string }{ Credentials: "credential", Files: "file", Items: "item", SchemaMigrations: "schema_migrations", Users: "user", }
var UserColumns = buildUserColumns("user")
var UserErrors = &userErrors{ ErrUniquePkMainUser: &UniqueConstraintError{ schema: "", table: "user", columns: []string{"id"}, s: "pk_main_user", }, }
var Users = sqlite.NewTablex[*User, UserSlice, *UserSetter]("", "user")
Users contains methods to work with the user table
Functions ¶
func CredentialExists ¶
CredentialExists checks the presence of a single record by primary key
func FileExists ¶
FileExists checks the presence of a single record by primary key
func ItemExists ¶
ItemExists checks the presence of a single record by primary key
func SchemaMigrationExists ¶
SchemaMigrationExists checks the presence of a single record by primary key
func UserExists ¶
UserExists checks the presence of a single record by primary key
func Where ¶
func Where[Q sqlite.Filterable]() struct { Credentials credentialWhere[Q] Files fileWhere[Q] Items itemWhere[Q] SchemaMigrations schemaMigrationWhere[Q] Users userWhere[Q] }
Types ¶
type Credential ¶
type Credential struct { CredID string `db:"cred_id,pk" ` CredPublicKey []byte `db:"cred_public_key" ` SignCount int32 `db:"sign_count" ` Transports sql.Null[string] `db:"transports" ` UserVerified sql.Null[bool] `db:"user_verified" ` BackupEligible sql.Null[bool] `db:"backup_eligible" ` BackupState sql.Null[bool] `db:"backup_state" ` AttestationObject sql.Null[[]byte] `db:"attestation_object" ` AttestationClientData sql.Null[[]byte] `db:"attestation_client_data" ` CreatedAt time.Time `db:"created_at" ` LastUsed time.Time `db:"last_used" ` UserID int32 `db:"user_id" ` R credentialR `db:"-" ` }
Credential is an object representing the database table.
func FindCredential ¶
func FindCredential(ctx context.Context, exec bob.Executor, CredIDPK string, cols ...string) (*Credential, error)
FindCredential retrieves a single record by primary key If cols is empty Find will return all columns.
func (*Credential) AfterQueryHook ¶
func (o *Credential) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
AfterQueryHook is called after Credential is retrieved from the database
func (*Credential) AttachUser ¶
func (*Credential) InsertUser ¶
func (credential0 *Credential) InsertUser(ctx context.Context, exec bob.Executor, related *UserSetter) error
func (*Credential) LoadUser ¶
func (o *Credential) LoadUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
LoadUser loads the credential's User into the .R struct
func (*Credential) Update ¶
func (o *Credential) Update(ctx context.Context, exec bob.Executor, s *CredentialSetter) error
Update uses an executor to update the Credential
func (*Credential) User ¶
func (o *Credential) User(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery
User starts a query for related objects on user
type CredentialSetter ¶
type CredentialSetter struct { CredID *string `db:"cred_id,pk" ` CredPublicKey *[]byte `db:"cred_public_key" ` SignCount *int32 `db:"sign_count" ` Transports *sql.Null[string] `db:"transports" ` UserVerified *sql.Null[bool] `db:"user_verified" ` BackupEligible *sql.Null[bool] `db:"backup_eligible" ` BackupState *sql.Null[bool] `db:"backup_state" ` AttestationObject *sql.Null[[]byte] `db:"attestation_object" ` AttestationClientData *sql.Null[[]byte] `db:"attestation_client_data" ` CreatedAt *time.Time `db:"created_at" ` LastUsed *time.Time `db:"last_used" ` UserID *int32 `db:"user_id" ` }
CredentialSetter is used for insert/upsert/update operations All values are optional, and do not have to be set Generated columns are not included
func (*CredentialSetter) Apply ¶
func (s *CredentialSetter) Apply(q *dialect.InsertQuery)
func (CredentialSetter) Expressions ¶
func (s CredentialSetter) Expressions(prefix ...string) []bob.Expression
func (CredentialSetter) Overwrite ¶
func (s CredentialSetter) Overwrite(t *Credential)
func (CredentialSetter) SetColumns ¶
func (s CredentialSetter) SetColumns() []string
func (CredentialSetter) UpdateMod ¶
func (s CredentialSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery]
type CredentialSlice ¶
type CredentialSlice []*Credential
CredentialSlice is an alias for a slice of pointers to Credential. This should almost always be used instead of []*Credential.
func (CredentialSlice) AfterQueryHook ¶
func (o CredentialSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
AfterQueryHook is called after CredentialSlice is retrieved from the database
func (CredentialSlice) DeleteMod ¶
func (o CredentialSlice) DeleteMod() bob.Mod[*dialect.DeleteQuery]
DeleteMod modifies an delete query with "WHERE primary_key IN (o...)"
func (CredentialSlice) LoadUser ¶
func (os CredentialSlice) LoadUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
LoadUser loads the credential's User into the .R struct
func (CredentialSlice) UpdateAll ¶
func (o CredentialSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals CredentialSetter) error
func (CredentialSlice) UpdateMod ¶
func (o CredentialSlice) UpdateMod() bob.Mod[*dialect.UpdateQuery]
UpdateMod modifies an update query with "WHERE primary_key IN (o...)"
func (CredentialSlice) User ¶
func (os CredentialSlice) User(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery
type CredentialsQuery ¶
type CredentialsQuery = *sqlite.ViewQuery[*Credential, CredentialSlice]
CredentialsQuery is a query on the credential table
type File ¶
type File struct { ID int32 `db:"id,pk" ` Name string `db:"name" ` Data []byte `db:"data" ` UserID int32 `db:"user_id" ` R fileR `db:"-" ` }
File is an object representing the database table.
func FindFile ¶
FindFile retrieves a single record by primary key If cols is empty Find will return all columns.
func (*File) AfterQueryHook ¶
func (o *File) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
AfterQueryHook is called after File is retrieved from the database
func (*File) AttachProfilePictureUsers ¶
func (*File) AttachUser ¶
func (*File) InsertProfilePictureUsers ¶
func (*File) InsertUser ¶
func (*File) LoadProfilePictureUsers ¶
func (o *File) LoadProfilePictureUsers(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
LoadProfilePictureUsers loads the file's ProfilePictureUsers into the .R struct
func (*File) LoadUser ¶
func (o *File) LoadUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
LoadUser loads the file's User into the .R struct
func (*File) ProfilePictureUsers ¶
func (o *File) ProfilePictureUsers(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery
ProfilePictureUsers starts a query for related objects on user
func (*File) User ¶
func (o *File) User(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery
User starts a query for related objects on user
type FileSetter ¶
type FileSetter struct { ID *int32 `db:"id,pk" ` Name *string `db:"name" ` Data *[]byte `db:"data" ` UserID *int32 `db:"user_id" ` }
FileSetter is used for insert/upsert/update operations All values are optional, and do not have to be set Generated columns are not included
func (*FileSetter) Apply ¶
func (s *FileSetter) Apply(q *dialect.InsertQuery)
func (FileSetter) Expressions ¶
func (s FileSetter) Expressions(prefix ...string) []bob.Expression
func (FileSetter) Overwrite ¶
func (s FileSetter) Overwrite(t *File)
func (FileSetter) SetColumns ¶
func (s FileSetter) SetColumns() []string
func (FileSetter) UpdateMod ¶
func (s FileSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery]
type FileSlice ¶
type FileSlice []*File
FileSlice is an alias for a slice of pointers to File. This should almost always be used instead of []*File.
func (FileSlice) AfterQueryHook ¶
func (o FileSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
AfterQueryHook is called after FileSlice is retrieved from the database
func (FileSlice) DeleteMod ¶
func (o FileSlice) DeleteMod() bob.Mod[*dialect.DeleteQuery]
DeleteMod modifies an delete query with "WHERE primary_key IN (o...)"
func (FileSlice) LoadProfilePictureUsers ¶
func (os FileSlice) LoadProfilePictureUsers(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
LoadProfilePictureUsers loads the file's ProfilePictureUsers into the .R struct
func (FileSlice) LoadUser ¶
func (os FileSlice) LoadUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
LoadUser loads the file's User into the .R struct
func (FileSlice) ProfilePictureUsers ¶
func (os FileSlice) ProfilePictureUsers(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery
func (FileSlice) UpdateMod ¶
func (o FileSlice) UpdateMod() bob.Mod[*dialect.UpdateQuery]
UpdateMod modifies an update query with "WHERE primary_key IN (o...)"
func (FileSlice) User ¶
func (os FileSlice) User(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery
type FilesQuery ¶
FilesQuery is a query on the file table
type Item ¶
type Item struct { ID int32 `db:"id,pk" ` Name string `db:"name" ` Added time.Time `db:"added" ` Description string `db:"description" ` Price float32 `db:"price" ` Quantity int32 `db:"quantity" ` UserID int32 `db:"user_id" ` R itemR `db:"-" ` }
Item is an object representing the database table.
func FindItem ¶
FindItem retrieves a single record by primary key If cols is empty Find will return all columns.
func (*Item) AfterQueryHook ¶
func (o *Item) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
AfterQueryHook is called after Item is retrieved from the database
func (*Item) AttachUser ¶
func (*Item) InsertUser ¶
func (*Item) LoadUser ¶
func (o *Item) LoadUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
LoadUser loads the item's User into the .R struct
func (*Item) User ¶
func (o *Item) User(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery
User starts a query for related objects on user
type ItemSetter ¶
type ItemSetter struct { ID *int32 `db:"id,pk" ` Name *string `db:"name" ` Added *time.Time `db:"added" ` Description *string `db:"description" ` Price *float32 `db:"price" ` Quantity *int32 `db:"quantity" ` UserID *int32 `db:"user_id" ` }
ItemSetter is used for insert/upsert/update operations All values are optional, and do not have to be set Generated columns are not included
func (*ItemSetter) Apply ¶
func (s *ItemSetter) Apply(q *dialect.InsertQuery)
func (ItemSetter) Expressions ¶
func (s ItemSetter) Expressions(prefix ...string) []bob.Expression
func (ItemSetter) Overwrite ¶
func (s ItemSetter) Overwrite(t *Item)
func (ItemSetter) SetColumns ¶
func (s ItemSetter) SetColumns() []string
func (ItemSetter) UpdateMod ¶
func (s ItemSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery]
type ItemSlice ¶
type ItemSlice []*Item
ItemSlice is an alias for a slice of pointers to Item. This should almost always be used instead of []*Item.
func (ItemSlice) AfterQueryHook ¶
func (o ItemSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
AfterQueryHook is called after ItemSlice is retrieved from the database
func (ItemSlice) DeleteMod ¶
func (o ItemSlice) DeleteMod() bob.Mod[*dialect.DeleteQuery]
DeleteMod modifies an delete query with "WHERE primary_key IN (o...)"
func (ItemSlice) LoadUser ¶
func (os ItemSlice) LoadUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
LoadUser loads the item's User into the .R struct
func (ItemSlice) UpdateMod ¶
func (o ItemSlice) UpdateMod() bob.Mod[*dialect.UpdateQuery]
UpdateMod modifies an update query with "WHERE primary_key IN (o...)"
func (ItemSlice) User ¶
func (os ItemSlice) User(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery
type ItemsQuery ¶
ItemsQuery is a query on the item table
type SchemaMigration ¶
type SchemaMigration struct {
Version string `db:"version,pk" `
}
SchemaMigration is an object representing the database table.
func FindSchemaMigration ¶
func FindSchemaMigration(ctx context.Context, exec bob.Executor, VersionPK string, cols ...string) (*SchemaMigration, error)
FindSchemaMigration retrieves a single record by primary key If cols is empty Find will return all columns.
func (*SchemaMigration) AfterQueryHook ¶
func (o *SchemaMigration) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
AfterQueryHook is called after SchemaMigration is retrieved from the database
func (*SchemaMigration) Update ¶
func (o *SchemaMigration) Update(ctx context.Context, exec bob.Executor, s *SchemaMigrationSetter) error
Update uses an executor to update the SchemaMigration
type SchemaMigrationSetter ¶
type SchemaMigrationSetter struct {
Version *string `db:"version,pk" `
}
SchemaMigrationSetter is used for insert/upsert/update operations All values are optional, and do not have to be set Generated columns are not included
func (*SchemaMigrationSetter) Apply ¶
func (s *SchemaMigrationSetter) Apply(q *dialect.InsertQuery)
func (SchemaMigrationSetter) Expressions ¶
func (s SchemaMigrationSetter) Expressions(prefix ...string) []bob.Expression
func (SchemaMigrationSetter) Overwrite ¶
func (s SchemaMigrationSetter) Overwrite(t *SchemaMigration)
func (SchemaMigrationSetter) SetColumns ¶
func (s SchemaMigrationSetter) SetColumns() []string
func (SchemaMigrationSetter) UpdateMod ¶
func (s SchemaMigrationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery]
type SchemaMigrationSlice ¶
type SchemaMigrationSlice []*SchemaMigration
SchemaMigrationSlice is an alias for a slice of pointers to SchemaMigration. This should almost always be used instead of []*SchemaMigration.
func (SchemaMigrationSlice) AfterQueryHook ¶
func (o SchemaMigrationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
AfterQueryHook is called after SchemaMigrationSlice is retrieved from the database
func (SchemaMigrationSlice) DeleteMod ¶
func (o SchemaMigrationSlice) DeleteMod() bob.Mod[*dialect.DeleteQuery]
DeleteMod modifies an delete query with "WHERE primary_key IN (o...)"
func (SchemaMigrationSlice) UpdateAll ¶
func (o SchemaMigrationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals SchemaMigrationSetter) error
func (SchemaMigrationSlice) UpdateMod ¶
func (o SchemaMigrationSlice) UpdateMod() bob.Mod[*dialect.UpdateQuery]
UpdateMod modifies an update query with "WHERE primary_key IN (o...)"
type SchemaMigrationsQuery ¶
type SchemaMigrationsQuery = *sqlite.ViewQuery[*SchemaMigration, SchemaMigrationSlice]
SchemaMigrationsQuery is a query on the schema_migrations table
type UniqueConstraintError ¶
type UniqueConstraintError struct {
// contains filtered or unexported fields
}
func (*UniqueConstraintError) Error ¶
func (e *UniqueConstraintError) Error() string
func (*UniqueConstraintError) Is ¶
func (e *UniqueConstraintError) Is(target error) bool
type User ¶
type User struct { ID int32 `db:"id,pk" ` Username string `db:"username" ` Password string `db:"password" ` ProfilePictureID sql.Null[int32] `db:"profile_picture_id" ` WebauthnID string `db:"webauthn_id" ` R userR `db:"-" ` }
User is an object representing the database table.
func FindUser ¶
FindUser retrieves a single record by primary key If cols is empty Find will return all columns.
func (*User) AfterQueryHook ¶
func (o *User) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
AfterQueryHook is called after User is retrieved from the database
func (*User) AttachCredentials ¶
func (*User) AttachFiles ¶
func (*User) AttachItems ¶
func (*User) AttachProfilePictureFile ¶
func (*User) Credentials ¶
func (o *User) Credentials(mods ...bob.Mod[*dialect.SelectQuery]) CredentialsQuery
Credentials starts a query for related objects on credential
func (*User) Files ¶
func (o *User) Files(mods ...bob.Mod[*dialect.SelectQuery]) FilesQuery
Files starts a query for related objects on file
func (*User) InsertCredentials ¶
func (*User) InsertFiles ¶
func (*User) InsertItems ¶
func (*User) InsertProfilePictureFile ¶
func (*User) Items ¶
func (o *User) Items(mods ...bob.Mod[*dialect.SelectQuery]) ItemsQuery
Items starts a query for related objects on item
func (*User) LoadCredentials ¶
func (o *User) LoadCredentials(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
LoadCredentials loads the user's Credentials into the .R struct
func (*User) LoadFiles ¶
func (o *User) LoadFiles(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
LoadFiles loads the user's Files into the .R struct
func (*User) LoadItems ¶
func (o *User) LoadItems(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
LoadItems loads the user's Items into the .R struct
func (*User) LoadProfilePictureFile ¶
func (o *User) LoadProfilePictureFile(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
LoadProfilePictureFile loads the user's ProfilePictureFile into the .R struct
func (*User) ProfilePictureFile ¶
func (o *User) ProfilePictureFile(mods ...bob.Mod[*dialect.SelectQuery]) FilesQuery
ProfilePictureFile starts a query for related objects on file
type UserSetter ¶
type UserSetter struct { ID *int32 `db:"id,pk" ` Username *string `db:"username" ` Password *string `db:"password" ` ProfilePictureID *sql.Null[int32] `db:"profile_picture_id" ` WebauthnID *string `db:"webauthn_id" ` }
UserSetter is used for insert/upsert/update operations All values are optional, and do not have to be set Generated columns are not included
func (*UserSetter) Apply ¶
func (s *UserSetter) Apply(q *dialect.InsertQuery)
func (UserSetter) Expressions ¶
func (s UserSetter) Expressions(prefix ...string) []bob.Expression
func (UserSetter) Overwrite ¶
func (s UserSetter) Overwrite(t *User)
func (UserSetter) SetColumns ¶
func (s UserSetter) SetColumns() []string
func (UserSetter) UpdateMod ¶
func (s UserSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery]
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) AfterQueryHook ¶
func (o UserSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error
AfterQueryHook is called after UserSlice is retrieved from the database
func (UserSlice) Credentials ¶
func (os UserSlice) Credentials(mods ...bob.Mod[*dialect.SelectQuery]) CredentialsQuery
func (UserSlice) DeleteMod ¶
func (o UserSlice) DeleteMod() bob.Mod[*dialect.DeleteQuery]
DeleteMod modifies an delete query with "WHERE primary_key IN (o...)"
func (UserSlice) Files ¶
func (os UserSlice) Files(mods ...bob.Mod[*dialect.SelectQuery]) FilesQuery
func (UserSlice) Items ¶
func (os UserSlice) Items(mods ...bob.Mod[*dialect.SelectQuery]) ItemsQuery
func (UserSlice) LoadCredentials ¶
func (os UserSlice) LoadCredentials(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
LoadCredentials loads the user's Credentials into the .R struct
func (UserSlice) LoadFiles ¶
func (os UserSlice) LoadFiles(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
LoadFiles loads the user's Files into the .R struct
func (UserSlice) LoadItems ¶
func (os UserSlice) LoadItems(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
LoadItems loads the user's Items into the .R struct
func (UserSlice) LoadProfilePictureFile ¶
func (os UserSlice) LoadProfilePictureFile(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error
LoadProfilePictureFile loads the user's ProfilePictureFile into the .R struct
func (UserSlice) ProfilePictureFile ¶
func (os UserSlice) ProfilePictureFile(mods ...bob.Mod[*dialect.SelectQuery]) FilesQuery