sqlboilergen

package
v0.0.0-...-a352382 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSyncFail = errors.New("sqlboilergen: 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 {
	Users            string
	UsersPermissions string
}{
	Users:            "users",
	UsersPermissions: "users_permissions",
}
View Source
var UserColumns = struct {
	ID   string
	Age  string
	Name string
}{
	ID:   "id",
	Age:  "age",
	Name: "name",
}
View Source
var UserRels = struct {
}{}

UserRels is where relationship names are stored.

View Source
var UserTableColumns = struct {
	ID   string
	Age  string
	Name string
}{
	ID:   "users.id",
	Age:  "users.age",
	Name: "users.name",
}
View Source
var UserWhere = struct {
	ID   whereHelperint
	Age  whereHelperint
	Name whereHelperstring
}{
	ID:   whereHelperint{/* contains filtered or unexported fields */},
	Age:  whereHelperint{/* contains filtered or unexported fields */},
	Name: whereHelperstring{/* contains filtered or unexported fields */},
}
View Source
var UsersPermissionColumns = struct {
	UserID string
	PostID string
}{
	UserID: "user_id",
	PostID: "post_id",
}
View Source
var UsersPermissionRels = struct {
}{}

UsersPermissionRels is where relationship names are stored.

View Source
var UsersPermissionTableColumns = struct {
	UserID string
	PostID string
}{
	UserID: "users_permissions.user_id",
	PostID: "users_permissions.post_id",
}
View Source
var UsersPermissionWhere = struct {
	UserID whereHelperint
	PostID whereHelperint
}{
	UserID: whereHelperint{/* contains filtered or unexported fields */},
	PostID: whereHelperint{/* contains filtered or unexported fields */},
}
View Source
var ViewNames = struct {
}{}

Functions

func AddUserHook

func AddUserHook(hookPoint boil.HookPoint, userHook UserHook)

AddUserHook registers your hook function for all future operations.

func AddUsersPermissionHook

func AddUsersPermissionHook(hookPoint boil.HookPoint, usersPermissionHook UsersPermissionHook)

AddUsersPermissionHook 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, iD int) (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.

func UsersPermissionExists

func UsersPermissionExists(ctx context.Context, exec boil.ContextExecutor, userID int, postID int) (bool, error)

UsersPermissionExists checks if the UsersPermission row exists.

func UsersPermissions

func UsersPermissions(mods ...qm.QueryMod) usersPermissionQuery

UsersPermissions 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 User

type User struct {
	ID   int    `boil:"id" json:"id" toml:"id" yaml:"id"`
	Age  int    `boil:"age" json:"age" toml:"age" yaml:"age"`
	Name string `boil:"name" json:"name" toml:"name" yaml:"name"`

	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 int, 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) 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 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.

type UsersPermission

type UsersPermission struct {
	UserID int `boil:"user_id" json:"user_id" toml:"user_id" yaml:"user_id"`
	PostID int `boil:"post_id" json:"post_id" toml:"post_id" yaml:"post_id"`

	R *usersPermissionR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L usersPermissionL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

UsersPermission is an object representing the database table.

func FindUsersPermission

func FindUsersPermission(ctx context.Context, exec boil.ContextExecutor, userID int, postID int, selectCols ...string) (*UsersPermission, error)

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

func (*UsersPermission) Delete

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

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

func (*UsersPermission) Insert

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

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

func (*UsersPermission) Update

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

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

func (o *UsersPermission) 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 UsersPermissionHook

type UsersPermissionHook func(context.Context, boil.ContextExecutor, *UsersPermission) error

UsersPermissionHook is the signature for custom UsersPermission hook methods

type UsersPermissionSlice

type UsersPermissionSlice []*UsersPermission

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

func (UsersPermissionSlice) DeleteAll

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

func (*UsersPermissionSlice) ReloadAll

ReloadAll refetches every row with matching primary key column values and overwrites the original object slice with the newly updated slice.

func (UsersPermissionSlice) UpdateAll

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