models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: Apache-2.0 Imports: 14 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 JetColumns = struct {
	ID      string
	PilotID string
	Age     string
	Name    string
	Color   string
}{
	ID:      "id",
	PilotID: "pilot_id",
	Age:     "age",
	Name:    "name",
	Color:   "color",
}
View Source
var JetRels = struct {
	Pilot string
}{
	Pilot: "Pilot",
}

JetRels is where relationship names are stored.

View Source
var LanguageColumns = struct {
	ID       string
	Language string
}{
	ID:       "id",
	Language: "language",
}
View Source
var LanguageRels = struct {
	Pilots string
}{
	Pilots: "Pilots",
}

LanguageRels is where relationship names are stored.

View Source
var PilotColumns = struct {
	ID   string
	Name string
}{
	ID:   "id",
	Name: "name",
}
View Source
var PilotRels = struct {
	Jets      string
	Languages string
}{
	Jets:      "Jets",
	Languages: "Languages",
}

PilotRels is where relationship names are stored.

View Source
var SchemaMigrationColumns = struct {
	Version string
	Dirty   string
}{
	Version: "version",
	Dirty:   "dirty",
}
View Source
var SchemaMigrationRels = struct {
}{}

SchemaMigrationRels is where relationship names are stored.

View Source
var TableNames = struct {
	Jets             string
	Languages        string
	PilotLanguages   string
	Pilots           string
	SchemaMigrations string
}{
	Jets:             "jets",
	Languages:        "languages",
	PilotLanguages:   "pilot_languages",
	Pilots:           "pilots",
	SchemaMigrations: "schema_migrations",
}

Functions

func AddJetHook

func AddJetHook(hookPoint boil.HookPoint, jetHook JetHook)

AddJetHook registers your hook function for all future operations.

func AddLanguageHook

func AddLanguageHook(hookPoint boil.HookPoint, languageHook LanguageHook)

AddLanguageHook registers your hook function for all future operations.

func AddPilotHook

func AddPilotHook(hookPoint boil.HookPoint, pilotHook PilotHook)

AddPilotHook registers your hook function for all future operations.

func AddSchemaMigrationHook

func AddSchemaMigrationHook(hookPoint boil.HookPoint, schemaMigrationHook SchemaMigrationHook)

AddSchemaMigrationHook registers your hook function for all future operations.

func JetExists

func JetExists(ctx context.Context, exec boil.ContextExecutor, iD int) (bool, error)

JetExists checks if the Jet row exists.

func Jets

func Jets(mods ...qm.QueryMod) jetQuery

Jets retrieves all the records using an executor.

func LanguageExists

func LanguageExists(ctx context.Context, exec boil.ContextExecutor, iD int) (bool, error)

LanguageExists checks if the Language row exists.

func Languages

func Languages(mods ...qm.QueryMod) languageQuery

Languages 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 PilotExists

func PilotExists(ctx context.Context, exec boil.ContextExecutor, iD int) (bool, error)

PilotExists checks if the Pilot row exists.

func Pilots

func Pilots(mods ...qm.QueryMod) pilotQuery

Pilots retrieves all the records using an executor.

func SchemaMigrationExists

func SchemaMigrationExists(ctx context.Context, exec boil.ContextExecutor, version int64) (bool, error)

SchemaMigrationExists checks if the SchemaMigration row exists.

func SchemaMigrations

func SchemaMigrations(mods ...qm.QueryMod) schemaMigrationQuery

SchemaMigrations retrieves all the records using an executor.

Types

type Jet

type Jet struct {
	ID      int    `boil:"id" json:"id" toml:"id" yaml:"id"`
	PilotID int    `boil:"pilot_id" json:"pilot_id" toml:"pilot_id" yaml:"pilot_id"`
	Age     int    `boil:"age" json:"age" toml:"age" yaml:"age"`
	Name    string `boil:"name" json:"name" toml:"name" yaml:"name"`
	Color   string `boil:"color" json:"color" toml:"color" yaml:"color"`

	R *jetR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L jetL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Jet is an object representing the database table.

func FindJet

func FindJet(ctx context.Context, exec boil.ContextExecutor, iD int, selectCols ...string) (*Jet, error)

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

func (*Jet) Delete

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

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

func (*Jet) Insert

func (o *Jet) 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 (*Jet) Pilot

func (o *Jet) Pilot(mods ...qm.QueryMod) pilotQuery

Pilot pointed to by the foreign key.

func (*Jet) Reload

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

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

func (*Jet) SetPilot

func (o *Jet) SetPilot(ctx context.Context, exec boil.ContextExecutor, insert bool, related *Pilot) error

SetPilot of the jet to the related item. Sets o.R.Pilot to related. Adds o to related.R.Jets.

func (*Jet) Update

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

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

func (o *Jet) 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 JetHook

type JetHook func(context.Context, boil.ContextExecutor, *Jet) error

JetHook is the signature for custom Jet hook methods

type JetSlice

type JetSlice []*Jet

JetSlice is an alias for a slice of pointers to Jet. This should generally be used opposed to []Jet.

func (JetSlice) DeleteAll

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

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

func (*JetSlice) ReloadAll

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

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

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

type Language

type Language struct {
	ID       int    `boil:"id" json:"id" toml:"id" yaml:"id"`
	Language string `boil:"language" json:"language" toml:"language" yaml:"language"`

	R *languageR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L languageL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Language is an object representing the database table.

func FindLanguage

func FindLanguage(ctx context.Context, exec boil.ContextExecutor, iD int, selectCols ...string) (*Language, error)

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

func (*Language) AddPilots

func (o *Language) AddPilots(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*Pilot) error

AddPilots adds the given related objects to the existing relationships of the language, optionally inserting them as new records. Appends related to o.R.Pilots. Sets related.R.Languages appropriately.

func (*Language) Delete

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

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

func (*Language) Insert

func (o *Language) 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 (*Language) Pilots

func (o *Language) Pilots(mods ...qm.QueryMod) pilotQuery

Pilots retrieves all the pilot's Pilots with an executor.

func (*Language) Reload

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

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

func (*Language) RemovePilots

func (o *Language) RemovePilots(ctx context.Context, exec boil.ContextExecutor, related ...*Pilot) error

RemovePilots relationships from objects passed in. Removes related items from R.Pilots (uses pointer comparison, removal does not keep order) Sets related.R.Languages.

func (*Language) SetPilots

func (o *Language) SetPilots(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*Pilot) error

SetPilots removes all previously related items of the language replacing them completely with the passed in related items, optionally inserting them as new records. Sets o.R.Languages's Pilots accordingly. Replaces o.R.Pilots with related. Sets related.R.Languages's Pilots accordingly.

func (*Language) Update

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

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

func (o *Language) 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 LanguageHook

type LanguageHook func(context.Context, boil.ContextExecutor, *Language) error

LanguageHook is the signature for custom Language hook methods

type LanguageSlice

type LanguageSlice []*Language

LanguageSlice is an alias for a slice of pointers to Language. This should generally be used opposed to []Language.

func (LanguageSlice) DeleteAll

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

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

func (*LanguageSlice) ReloadAll

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

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

type NameAndLanguage struct {
	Name     string
	Language string
}

type Pilot

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

	R *pilotR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L pilotL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Pilot is an object representing the database table.

func FindPilot

func FindPilot(ctx context.Context, exec boil.ContextExecutor, iD int, selectCols ...string) (*Pilot, error)

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

func (*Pilot) AddJets

func (o *Pilot) AddJets(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*Jet) error

AddJets adds the given related objects to the existing relationships of the pilot, optionally inserting them as new records. Appends related to o.R.Jets. Sets related.R.Pilot appropriately.

func (*Pilot) AddLanguages

func (o *Pilot) AddLanguages(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*Language) error

AddLanguages adds the given related objects to the existing relationships of the pilot, optionally inserting them as new records. Appends related to o.R.Languages. Sets related.R.Pilots appropriately.

func (*Pilot) Delete

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

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

func (*Pilot) Insert

func (o *Pilot) 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 (*Pilot) Jets

func (o *Pilot) Jets(mods ...qm.QueryMod) jetQuery

Jets retrieves all the jet's Jets with an executor.

func (*Pilot) Languages

func (o *Pilot) Languages(mods ...qm.QueryMod) languageQuery

Languages retrieves all the language's Languages with an executor.

func (*Pilot) Reload

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

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

func (*Pilot) RemoveLanguages

func (o *Pilot) RemoveLanguages(ctx context.Context, exec boil.ContextExecutor, related ...*Language) error

RemoveLanguages relationships from objects passed in. Removes related items from R.Languages (uses pointer comparison, removal does not keep order) Sets related.R.Pilots.

func (*Pilot) SetLanguages

func (o *Pilot) SetLanguages(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*Language) error

SetLanguages removes all previously related items of the pilot replacing them completely with the passed in related items, optionally inserting them as new records. Sets o.R.Pilots's Languages accordingly. Replaces o.R.Languages with related. Sets related.R.Pilots's Languages accordingly.

func (*Pilot) Update

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

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

func (o *Pilot) 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 PilotHook

type PilotHook func(context.Context, boil.ContextExecutor, *Pilot) error

PilotHook is the signature for custom Pilot hook methods

type PilotSlice

type PilotSlice []*Pilot

PilotSlice is an alias for a slice of pointers to Pilot. This should generally be used opposed to []Pilot.

func (PilotSlice) DeleteAll

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

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

func (*PilotSlice) ReloadAll

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

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

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

type SchemaMigration

type SchemaMigration struct {
	Version int64 `boil:"version" json:"version" toml:"version" yaml:"version"`
	Dirty   bool  `boil:"dirty" json:"dirty" toml:"dirty" yaml:"dirty"`

	R *schemaMigrationR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L schemaMigrationL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

SchemaMigration is an object representing the database table.

func FindSchemaMigration

func FindSchemaMigration(ctx context.Context, exec boil.ContextExecutor, version int64, selectCols ...string) (*SchemaMigration, error)

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

func (*SchemaMigration) Delete

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

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

func (*SchemaMigration) Insert

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

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

func (*SchemaMigration) Update

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

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

func (o *SchemaMigration) 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 SchemaMigrationHook

type SchemaMigrationHook func(context.Context, boil.ContextExecutor, *SchemaMigration) error

SchemaMigrationHook is the signature for custom SchemaMigration hook methods

type SchemaMigrationSlice

type SchemaMigrationSlice []*SchemaMigration

SchemaMigrationSlice is an alias for a slice of pointers to SchemaMigration. This should generally be used opposed to []SchemaMigration.

func (SchemaMigrationSlice) DeleteAll

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

func (*SchemaMigrationSlice) ReloadAll

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

func (SchemaMigrationSlice) UpdateAll

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