models

package
v0.0.0-...-ed93a40 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 16 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 RecordColumns = struct {
	ID        string
	CreatedAt string
	UpdatedAt string
	Title     string
	Artist    string
	Label     string
	CN        string
	Genre     string
	Released  string
	Purchased string
	Medium    string
}{
	ID:        "id",
	CreatedAt: "created_at",
	UpdatedAt: "updated_at",
	Title:     "title",
	Artist:    "artist",
	Label:     "label",
	CN:        "cn",
	Genre:     "genre",
	Released:  "released",
	Purchased: "purchased",
	Medium:    "medium",
}
View Source
var RecordRels = struct {
}{}

RecordRels is where relationship names are stored.

View Source
var RecordTableColumns = struct {
	ID        string
	CreatedAt string
	UpdatedAt string
	Title     string
	Artist    string
	Label     string
	CN        string
	Genre     string
	Released  string
	Purchased string
	Medium    string
}{
	ID:        "records.id",
	CreatedAt: "records.created_at",
	UpdatedAt: "records.updated_at",
	Title:     "records.title",
	Artist:    "records.artist",
	Label:     "records.label",
	CN:        "records.cn",
	Genre:     "records.genre",
	Released:  "records.released",
	Purchased: "records.purchased",
	Medium:    "records.medium",
}
View Source
var RecordWhere = struct {
	ID        whereHelperint64
	CreatedAt whereHelpertime_Time
	UpdatedAt whereHelpertime_Time
	Title     whereHelperstring
	Artist    whereHelperstring
	Label     whereHelperstring
	CN        whereHelperstring
	Genre     whereHelperstring
	Released  whereHelpertime_Time
	Purchased whereHelpernull_Time
	Medium    whereHelperMedium
}{
	ID:        whereHelperint64{/* contains filtered or unexported fields */},
	CreatedAt: whereHelpertime_Time{/* contains filtered or unexported fields */},
	UpdatedAt: whereHelpertime_Time{/* contains filtered or unexported fields */},
	Title:     whereHelperstring{/* contains filtered or unexported fields */},
	Artist:    whereHelperstring{/* contains filtered or unexported fields */},
	Label:     whereHelperstring{/* contains filtered or unexported fields */},
	CN:        whereHelperstring{/* contains filtered or unexported fields */},
	Genre:     whereHelperstring{/* contains filtered or unexported fields */},
	Released:  whereHelpertime_Time{/* contains filtered or unexported fields */},
	Purchased: whereHelpernull_Time{/* contains filtered or unexported fields */},
	Medium:    whereHelperMedium{/* contains filtered or unexported fields */},
}
View Source
var TableNames = struct {
	Records string
}{
	Records: "records",
}
View Source
var ViewNames = struct {
}{}

Functions

func NewQuery

func NewQuery(mods ...qm.QueryMod) *queries.Query

NewQuery initializes a new Query using the passed in QueryMods

func RecordExists

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

RecordExists checks if the Record row exists.

func Records

func Records(mods ...qm.QueryMod) recordQuery

Records 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 Medium

type Medium string
const (
	MediumCD       Medium = "cd"
	MediumVinyl    Medium = "vinyl"
	MediumCassette Medium = "cassette"
)

Enum values for Medium

func AllMedium

func AllMedium() []Medium

func (Medium) IsValid

func (e Medium) IsValid() error

func (Medium) String

func (e Medium) String() string

type Record

type Record struct {
	ID        int64     `boil:"id" json:"id" toml:"id" yaml:"id"`
	CreatedAt time.Time `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
	UpdatedAt time.Time `boil:"updated_at" json:"updated_at" toml:"updated_at" yaml:"updated_at"`
	Title     string    `boil:"title" json:"title" toml:"title" yaml:"title"`
	Artist    string    `boil:"artist" json:"artist" toml:"artist" yaml:"artist"`
	Label     string    `boil:"label" json:"label" toml:"label" yaml:"label"`
	CN        string    `boil:"cn" json:"cn" toml:"cn" yaml:"cn"`
	Genre     string    `boil:"genre" json:"genre" toml:"genre" yaml:"genre"`
	Released  time.Time `boil:"released" json:"released" toml:"released" yaml:"released"`
	Purchased null.Time `boil:"purchased" json:"purchased,omitempty" toml:"purchased" yaml:"purchased,omitempty"`
	Medium    Medium    `boil:"medium" json:"medium" toml:"medium" yaml:"medium"`

	R *recordR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L recordL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Record is an object representing the database table.

func FindRecord

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

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

func (*Record) Delete

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

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

func (*Record) Exists

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

Exists checks if the Record row exists.

func (*Record) Insert

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

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

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

func (*Record) Update

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

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

func (o *Record) 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 RecordSlice

type RecordSlice []*Record

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

func (RecordSlice) DeleteAll

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

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

func (*RecordSlice) ReloadAll

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

func (o RecordSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) 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