models

package
v0.0.0-...-9d9be1d Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BallotCheckModeNone        = "none"
	BallotCheckModeIP          = "ip"
	BallotCheckModeCookie      = "cookie"
	BallotCheckModeIPAndCookie = "ip_and_cookie"
)

Enum values for ballot_check_mode

Variables

View Source
var BallotColumns = struct {
	ID        string
	CreatedAt string
	UpdatedAt string
	PollID    string
	Cookie    string
	IPAddr    string
	Votes     string
}{
	ID:        "id",
	CreatedAt: "created_at",
	UpdatedAt: "updated_at",
	PollID:    "poll_id",
	Cookie:    "cookie",
	IPAddr:    "ip_addr",
	Votes:     "votes",
}
View Source
var BallotRels = struct {
	Poll string
}{
	Poll: "Poll",
}

BallotRels is where relationship names are stored.

View Source
var BallotWhere = struct {
	ID        whereHelperint64
	CreatedAt whereHelpertime_Time
	UpdatedAt whereHelpertime_Time
	PollID    whereHelperint64
	Cookie    whereHelpernull_String
	IPAddr    whereHelpernull_String
	Votes     whereHelpertypes_Int64Array
}{
	ID:        whereHelperint64{/* contains filtered or unexported fields */},
	CreatedAt: whereHelpertime_Time{/* contains filtered or unexported fields */},
	UpdatedAt: whereHelpertime_Time{/* contains filtered or unexported fields */},
	PollID:    whereHelperint64{/* contains filtered or unexported fields */},
	Cookie:    whereHelpernull_String{/* contains filtered or unexported fields */},
	IPAddr:    whereHelpernull_String{/* contains filtered or unexported fields */},
	Votes:     whereHelpertypes_Int64Array{/* contains filtered or unexported fields */},
}
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 PollColumns = struct {
	ID        string
	CreatedAt string
	UpdatedAt string
	Question  string
	Choices   string
	CheckMode string
}{
	ID:        "id",
	CreatedAt: "created_at",
	UpdatedAt: "updated_at",
	Question:  "question",
	Choices:   "choices",
	CheckMode: "check_mode",
}
View Source
var PollRels = struct {
	Ballots string
}{
	Ballots: "Ballots",
}

PollRels is where relationship names are stored.

View Source
var PollWhere = struct {
	ID        whereHelperint64
	CreatedAt whereHelpertime_Time
	UpdatedAt whereHelpertime_Time
	Question  whereHelperstring
	Choices   whereHelpertypes_StringArray
	CheckMode whereHelperstring
}{
	ID:        whereHelperint64{/* contains filtered or unexported fields */},
	CreatedAt: whereHelpertime_Time{/* contains filtered or unexported fields */},
	UpdatedAt: whereHelpertime_Time{/* contains filtered or unexported fields */},
	Question:  whereHelperstring{/* contains filtered or unexported fields */},
	Choices:   whereHelpertypes_StringArray{/* contains filtered or unexported fields */},
	CheckMode: whereHelperstring{/* contains filtered or unexported fields */},
}
View Source
var TableNames = struct {
	Ballots string
	Polls   string
}{
	Ballots: "ballots",
	Polls:   "polls",
}

Functions

func BallotExists

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

BallotExists checks if the Ballot row exists.

func Ballots

func Ballots(mods ...qm.QueryMod) ballotQuery

Ballots 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 PollExists

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

PollExists checks if the Poll row exists.

func Polls

func Polls(mods ...qm.QueryMod) pollQuery

Polls retrieves all the records using an executor.

Types

type Ballot

type Ballot 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"`
	PollID    int64            `boil:"poll_id" json:"poll_id" toml:"poll_id" yaml:"poll_id"`
	Cookie    null.String      `boil:"cookie" json:"cookie,omitempty" toml:"cookie" yaml:"cookie,omitempty"`
	IPAddr    null.String      `boil:"ip_addr" json:"ip_addr,omitempty" toml:"ip_addr" yaml:"ip_addr,omitempty"`
	Votes     types.Int64Array `boil:"votes" json:"votes,omitempty" toml:"votes" yaml:"votes,omitempty"`

	R *ballotR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L ballotL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Ballot is an object representing the database table.

func FindBallot

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

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

func (*Ballot) Delete

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

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

func (*Ballot) Insert

func (o *Ballot) 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 (*Ballot) Poll

func (o *Ballot) Poll(mods ...qm.QueryMod) pollQuery

Poll pointed to by the foreign key.

func (*Ballot) Reload

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

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

func (*Ballot) SetPoll

func (o *Ballot) SetPoll(ctx context.Context, exec boil.ContextExecutor, insert bool, related *Poll) error

SetPoll of the ballot to the related item. Sets o.R.Poll to related. Adds o to related.R.Ballots.

func (*Ballot) Update

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

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

func (o *Ballot) 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 BallotSlice

type BallotSlice []*Ballot

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

func (BallotSlice) DeleteAll

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

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

func (*BallotSlice) ReloadAll

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

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

type Poll 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"`
	Question  string            `boil:"question" json:"question" toml:"question" yaml:"question"`
	Choices   types.StringArray `boil:"choices" json:"choices,omitempty" toml:"choices" yaml:"choices,omitempty"`
	CheckMode string            `boil:"check_mode" json:"check_mode" toml:"check_mode" yaml:"check_mode"`

	R *pollR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L pollL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Poll is an object representing the database table.

func FindPoll

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

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

func (*Poll) AddBallots

func (o *Poll) AddBallots(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*Ballot) error

AddBallots adds the given related objects to the existing relationships of the poll, optionally inserting them as new records. Appends related to o.R.Ballots. Sets related.R.Poll appropriately.

func (*Poll) Ballots

func (o *Poll) Ballots(mods ...qm.QueryMod) ballotQuery

Ballots retrieves all the ballot's Ballots with an executor.

func (*Poll) Delete

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

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

func (*Poll) Insert

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

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

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

func (*Poll) Update

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

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

func (o *Poll) 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 PollSlice

type PollSlice []*Poll

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

func (PollSlice) DeleteAll

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

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

func (*PollSlice) ReloadAll

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

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