model

package
v0.0.0-...-3a27eef Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2020 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DiaryColumns = struct {
	ID        string
	CreatedAt string
	UpdatedAt string
	DeletedAt string
	Year      string
	UserID    string
}{
	ID:        "id",
	CreatedAt: "created_at",
	UpdatedAt: "updated_at",
	DeletedAt: "deleted_at",
	Year:      "year",
	UserID:    "user_id",
}
View Source
var DiaryRels = struct {
	User string
}{
	User: "User",
}

DiaryRels is where relationship names are stored.

View Source
var DiaryWhere = struct {
	ID        whereHelperint
	CreatedAt whereHelpernull_Time
	UpdatedAt whereHelpernull_Time
	DeletedAt whereHelpernull_Time
	Year      whereHelperint
	UserID    whereHelpernull_Int
}{
	ID:        whereHelperint{/* contains filtered or unexported fields */},
	CreatedAt: whereHelpernull_Time{/* contains filtered or unexported fields */},
	UpdatedAt: whereHelpernull_Time{/* contains filtered or unexported fields */},
	DeletedAt: whereHelpernull_Time{/* contains filtered or unexported fields */},
	Year:      whereHelperint{/* contains filtered or unexported fields */},
	UserID:    whereHelpernull_Int{/* contains filtered or unexported fields */},
}
View Source
var ErrSyncFail = errors.New("model: 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 PersonColumns = struct {
	ID        string
	CreatedAt string
	UpdatedAt string
	DeletedAt string
	FirstName string
	LastName  string
	Phone     string
	Email     string
	UserID    string
}{
	ID:        "id",
	CreatedAt: "created_at",
	UpdatedAt: "updated_at",
	DeletedAt: "deleted_at",
	FirstName: "first_name",
	LastName:  "last_name",
	Phone:     "phone",
	Email:     "email",
	UserID:    "user_id",
}
View Source
var PersonRels = struct {
	User string
}{
	User: "User",
}

PersonRels is where relationship names are stored.

View Source
var PersonWhere = struct {
	ID        whereHelperint
	CreatedAt whereHelpernull_Time
	UpdatedAt whereHelpernull_Time
	DeletedAt whereHelpernull_Time
	FirstName whereHelperstring
	LastName  whereHelpernull_String
	Phone     whereHelpernull_String
	Email     whereHelpernull_String
	UserID    whereHelpernull_Int
}{
	ID:        whereHelperint{/* contains filtered or unexported fields */},
	CreatedAt: whereHelpernull_Time{/* contains filtered or unexported fields */},
	UpdatedAt: whereHelpernull_Time{/* contains filtered or unexported fields */},
	DeletedAt: whereHelpernull_Time{/* contains filtered or unexported fields */},
	FirstName: whereHelperstring{/* contains filtered or unexported fields */},
	LastName:  whereHelpernull_String{/* contains filtered or unexported fields */},
	Phone:     whereHelpernull_String{/* contains filtered or unexported fields */},
	Email:     whereHelpernull_String{/* contains filtered or unexported fields */},
	UserID:    whereHelpernull_Int{/* contains filtered or unexported fields */},
}
View Source
var TableNames = struct {
	Diary  string
	Person string
	Users  string
}{
	Diary:  "diary",
	Person: "person",
	Users:  "users",
}
View Source
var UserColumns = struct {
	ID        string
	CreatedAt string
	UpdatedAt string
	DeletedAt string
	Login     string
	Password  string
}{
	ID:        "id",
	CreatedAt: "created_at",
	UpdatedAt: "updated_at",
	DeletedAt: "deleted_at",
	Login:     "login",
	Password:  "password",
}
View Source
var UserRels = struct {
	Diaries string
	People  string
}{
	Diaries: "Diaries",
	People:  "People",
}

UserRels is where relationship names are stored.

View Source
var UserWhere = struct {
	ID        whereHelperint
	CreatedAt whereHelpernull_Time
	UpdatedAt whereHelpernull_Time
	DeletedAt whereHelpernull_Time
	Login     whereHelperstring
	Password  whereHelperstring
}{
	ID:        whereHelperint{/* contains filtered or unexported fields */},
	CreatedAt: whereHelpernull_Time{/* contains filtered or unexported fields */},
	UpdatedAt: whereHelpernull_Time{/* contains filtered or unexported fields */},
	DeletedAt: whereHelpernull_Time{/* contains filtered or unexported fields */},
	Login:     whereHelperstring{/* contains filtered or unexported fields */},
	Password:  whereHelperstring{/* contains filtered or unexported fields */},
}

Functions

func AddDiaryHook

func AddDiaryHook(hookPoint boil.HookPoint, diaryHook DiaryHook)

AddDiaryHook registers your hook function for all future operations.

func AddPersonHook

func AddPersonHook(hookPoint boil.HookPoint, personHook PersonHook)

AddPersonHook 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 Diaries

func Diaries(mods ...qm.QueryMod) diaryQuery

Diaries retrieves all the records using an executor.

func DiaryExists

func DiaryExists(exec boil.Executor, iD int) (bool, error)

DiaryExists checks if the Diary row exists.

func NewQuery

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

NewQuery initializes a new Query using the passed in QueryMods

func People

func People(mods ...qm.QueryMod) personQuery

People retrieves all the records using an executor.

func PersonExists

func PersonExists(exec boil.Executor, iD int) (bool, error)

PersonExists checks if the Person row exists.

func UserExists

func UserExists(exec boil.Executor, 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.

Types

type Diary

type Diary struct {
	ID        int       `boil:"id" json:"id" toml:"id" yaml:"id"`
	CreatedAt null.Time `boil:"created_at" json:"created_at,omitempty" toml:"created_at" yaml:"created_at,omitempty"`
	UpdatedAt null.Time `boil:"updated_at" json:"updated_at,omitempty" toml:"updated_at" yaml:"updated_at,omitempty"`
	DeletedAt null.Time `boil:"deleted_at" json:"deleted_at,omitempty" toml:"deleted_at" yaml:"deleted_at,omitempty"`
	Year      int       `boil:"year" json:"year" toml:"year" yaml:"year"`
	UserID    null.Int  `boil:"user_id" json:"user_id,omitempty" toml:"user_id" yaml:"user_id,omitempty"`

	R *diaryR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L diaryL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Diary is an object representing the database table.

func FindDiary

func FindDiary(exec boil.Executor, iD int, selectCols ...string) (*Diary, error)

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

func (*Diary) Delete

func (o *Diary) Delete(exec boil.Executor) (int64, error)

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

func (*Diary) Insert

func (o *Diary) Insert(exec boil.Executor, columns boil.Columns) error

Insert a single record using an executor. See boil.Columns.InsertColumnSet documentation to understand column list inference for inserts.

func (*Diary) Reload

func (o *Diary) Reload(exec boil.Executor) error

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

func (*Diary) RemoveUser

func (o *Diary) RemoveUser(exec boil.Executor, related *User) error

RemoveUser relationship. Sets o.R.User to nil. Removes o from all passed in related items' relationships struct (Optional).

func (*Diary) SetUser

func (o *Diary) SetUser(exec boil.Executor, insert bool, related *User) error

SetUser of the diary to the related item. Sets o.R.User to related. Adds o to related.R.Diaries.

func (*Diary) Update

func (o *Diary) Update(exec boil.Executor, columns boil.Columns) (int64, error)

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

func (o *Diary) Upsert(exec boil.Executor, 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 (*Diary) User

func (o *Diary) User(mods ...qm.QueryMod) userQuery

User pointed to by the foreign key.

type DiaryHook

type DiaryHook func(boil.Executor, *Diary) error

DiaryHook is the signature for custom Diary hook methods

type DiarySlice

type DiarySlice []*Diary

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

func (DiarySlice) DeleteAll

func (o DiarySlice) DeleteAll(exec boil.Executor) (int64, error)

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

func (*DiarySlice) ReloadAll

func (o *DiarySlice) ReloadAll(exec boil.Executor) error

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

func (DiarySlice) UpdateAll

func (o DiarySlice) UpdateAll(exec boil.Executor, 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 Person

type Person struct {
	ID        int         `boil:"id" json:"id" toml:"id" yaml:"id"`
	CreatedAt null.Time   `boil:"created_at" json:"created_at,omitempty" toml:"created_at" yaml:"created_at,omitempty"`
	UpdatedAt null.Time   `boil:"updated_at" json:"updated_at,omitempty" toml:"updated_at" yaml:"updated_at,omitempty"`
	DeletedAt null.Time   `boil:"deleted_at" json:"deleted_at,omitempty" toml:"deleted_at" yaml:"deleted_at,omitempty"`
	FirstName string      `boil:"first_name" json:"first_name" toml:"first_name" yaml:"first_name"`
	LastName  null.String `boil:"last_name" json:"last_name,omitempty" toml:"last_name" yaml:"last_name,omitempty"`
	Phone     null.String `boil:"phone" json:"phone,omitempty" toml:"phone" yaml:"phone,omitempty"`
	Email     null.String `boil:"email" json:"email,omitempty" toml:"email" yaml:"email,omitempty"`
	UserID    null.Int    `boil:"user_id" json:"user_id,omitempty" toml:"user_id" yaml:"user_id,omitempty"`

	R *personR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L personL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Person is an object representing the database table.

func FindPerson

func FindPerson(exec boil.Executor, iD int, selectCols ...string) (*Person, error)

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

func (*Person) Delete

func (o *Person) Delete(exec boil.Executor) (int64, error)

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

func (*Person) Insert

func (o *Person) Insert(exec boil.Executor, columns boil.Columns) error

Insert a single record using an executor. See boil.Columns.InsertColumnSet documentation to understand column list inference for inserts.

func (*Person) Reload

func (o *Person) Reload(exec boil.Executor) error

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

func (*Person) RemoveUser

func (o *Person) RemoveUser(exec boil.Executor, related *User) error

RemoveUser relationship. Sets o.R.User to nil. Removes o from all passed in related items' relationships struct (Optional).

func (*Person) SetUser

func (o *Person) SetUser(exec boil.Executor, insert bool, related *User) error

SetUser of the person to the related item. Sets o.R.User to related. Adds o to related.R.People.

func (*Person) Update

func (o *Person) Update(exec boil.Executor, columns boil.Columns) (int64, error)

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

func (o *Person) Upsert(exec boil.Executor, 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 (*Person) User

func (o *Person) User(mods ...qm.QueryMod) userQuery

User pointed to by the foreign key.

type PersonHook

type PersonHook func(boil.Executor, *Person) error

PersonHook is the signature for custom Person hook methods

type PersonSlice

type PersonSlice []*Person

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

func (PersonSlice) DeleteAll

func (o PersonSlice) DeleteAll(exec boil.Executor) (int64, error)

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

func (*PersonSlice) ReloadAll

func (o *PersonSlice) ReloadAll(exec boil.Executor) error

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

func (PersonSlice) UpdateAll

func (o PersonSlice) UpdateAll(exec boil.Executor, cols M) (int64, error)

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

type User

type User struct {
	ID        int       `boil:"id" json:"id" toml:"id" yaml:"id"`
	CreatedAt null.Time `boil:"created_at" json:"created_at,omitempty" toml:"created_at" yaml:"created_at,omitempty"`
	UpdatedAt null.Time `boil:"updated_at" json:"updated_at,omitempty" toml:"updated_at" yaml:"updated_at,omitempty"`
	DeletedAt null.Time `boil:"deleted_at" json:"deleted_at,omitempty" toml:"deleted_at" yaml:"deleted_at,omitempty"`
	Login     string    `boil:"login" json:"login" toml:"login" yaml:"login"`
	Password  string    `boil:"password" json:"password" toml:"password" yaml:"password"`

	R *userR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L userL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

User is an object representing the database table.

func FindUser

func FindUser(exec boil.Executor, 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) AddDiaries

func (o *User) AddDiaries(exec boil.Executor, insert bool, related ...*Diary) error

AddDiaries adds the given related objects to the existing relationships of the user, optionally inserting them as new records. Appends related to o.R.Diaries. Sets related.R.User appropriately.

func (*User) AddPeople

func (o *User) AddPeople(exec boil.Executor, insert bool, related ...*Person) error

AddPeople adds the given related objects to the existing relationships of the user, optionally inserting them as new records. Appends related to o.R.People. Sets related.R.User appropriately.

func (*User) Delete

func (o *User) Delete(exec boil.Executor) (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) Diaries

func (o *User) Diaries(mods ...qm.QueryMod) diaryQuery

Diaries retrieves all the diary's Diaries with an executor.

func (*User) Insert

func (o *User) Insert(exec boil.Executor, 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) People

func (o *User) People(mods ...qm.QueryMod) personQuery

People retrieves all the person's People with an executor.

func (*User) Reload

func (o *User) Reload(exec boil.Executor) error

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

func (*User) RemoveDiaries

func (o *User) RemoveDiaries(exec boil.Executor, related ...*Diary) error

RemoveDiaries relationships from objects passed in. Removes related items from R.Diaries (uses pointer comparison, removal does not keep order) Sets related.R.User.

func (*User) RemovePeople

func (o *User) RemovePeople(exec boil.Executor, related ...*Person) error

RemovePeople relationships from objects passed in. Removes related items from R.People (uses pointer comparison, removal does not keep order) Sets related.R.User.

func (*User) SetDiaries

func (o *User) SetDiaries(exec boil.Executor, insert bool, related ...*Diary) error

SetDiaries 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.User's Diaries accordingly. Replaces o.R.Diaries with related. Sets related.R.User's Diaries accordingly.

func (*User) SetPeople

func (o *User) SetPeople(exec boil.Executor, insert bool, related ...*Person) error

SetPeople 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.User's People accordingly. Replaces o.R.People with related. Sets related.R.User's People accordingly.

func (*User) Update

func (o *User) Update(exec boil.Executor, 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(exec boil.Executor, 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(boil.Executor, *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 generally be used opposed to []User.

func (UserSlice) DeleteAll

func (o UserSlice) DeleteAll(exec boil.Executor) (int64, error)

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

func (*UserSlice) ReloadAll

func (o *UserSlice) ReloadAll(exec boil.Executor) 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(exec boil.Executor, 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