models

package
v0.0.0-...-c99e1c3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AnswerColumns = struct {
	ID        string
	UserID    string
	ChoiceID  string
	CreatedAt string
}{
	ID:        "id",
	UserID:    "user_id",
	ChoiceID:  "choice_id",
	CreatedAt: "created_at",
}
View Source
var AnswerRels = struct {
	Choice string
}{
	Choice: "Choice",
}

AnswerRels is where relationship names are stored.

View Source
var AnswerTableColumns = struct {
	ID        string
	UserID    string
	ChoiceID  string
	CreatedAt string
}{
	ID:        "answers.id",
	UserID:    "answers.user_id",
	ChoiceID:  "answers.choice_id",
	CreatedAt: "answers.created_at",
}
View Source
var AnswerWhere = struct {
	ID        whereHelperstring
	UserID    whereHelperstring
	ChoiceID  whereHelperstring
	CreatedAt whereHelpertime_Time
}{
	ID:        whereHelperstring{/* contains filtered or unexported fields */},
	UserID:    whereHelperstring{/* contains filtered or unexported fields */},
	ChoiceID:  whereHelperstring{/* contains filtered or unexported fields */},
	CreatedAt: whereHelpertime_Time{/* contains filtered or unexported fields */},
}
View Source
var ChoiceColumns = struct {
	ID         string
	QuestionID string
	Choice     string
	IsCorrect  string
	CreatedAt  string
}{
	ID:         "id",
	QuestionID: "question_id",
	Choice:     "choice",
	IsCorrect:  "is_correct",
	CreatedAt:  "created_at",
}
View Source
var ChoiceRels = struct {
	Question string
	Answers  string
}{
	Question: "Question",
	Answers:  "Answers",
}

ChoiceRels is where relationship names are stored.

View Source
var ChoiceTableColumns = struct {
	ID         string
	QuestionID string
	Choice     string
	IsCorrect  string
	CreatedAt  string
}{
	ID:         "choices.id",
	QuestionID: "choices.question_id",
	Choice:     "choices.choice",
	IsCorrect:  "choices.is_correct",
	CreatedAt:  "choices.created_at",
}
View Source
var ChoiceWhere = struct {
	ID         whereHelperstring
	QuestionID whereHelperstring
	Choice     whereHelperstring
	IsCorrect  whereHelperbool
	CreatedAt  whereHelpertime_Time
}{
	ID:         whereHelperstring{/* contains filtered or unexported fields */},
	QuestionID: whereHelperstring{/* contains filtered or unexported fields */},
	Choice:     whereHelperstring{/* contains filtered or unexported fields */},
	IsCorrect:  whereHelperbool{/* contains filtered or unexported fields */},
	CreatedAt:  whereHelpertime_Time{/* 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 QuestionColumns = struct {
	ID         string
	Question   string
	Hint       string
	CreatedAt  string
	Difficulty string
	Topic      string
	MoreInfo   string
}{
	ID:         "id",
	Question:   "question",
	Hint:       "hint",
	CreatedAt:  "created_at",
	Difficulty: "difficulty",
	Topic:      "topic",
	MoreInfo:   "more_info",
}
View Source
var QuestionRels = struct {
	Choices string
}{
	Choices: "Choices",
}

QuestionRels is where relationship names are stored.

View Source
var QuestionTableColumns = struct {
	ID         string
	Question   string
	Hint       string
	CreatedAt  string
	Difficulty string
	Topic      string
	MoreInfo   string
}{
	ID:         "questions.id",
	Question:   "questions.question",
	Hint:       "questions.hint",
	CreatedAt:  "questions.created_at",
	Difficulty: "questions.difficulty",
	Topic:      "questions.topic",
	MoreInfo:   "questions.more_info",
}
View Source
var QuestionWhere = struct {
	ID         whereHelperstring
	Question   whereHelperstring
	Hint       whereHelperstring
	CreatedAt  whereHelpertime_Time
	Difficulty whereHelperstring
	Topic      whereHelperstring
	MoreInfo   whereHelperstring
}{
	ID:         whereHelperstring{/* contains filtered or unexported fields */},
	Question:   whereHelperstring{/* contains filtered or unexported fields */},
	Hint:       whereHelperstring{/* contains filtered or unexported fields */},
	CreatedAt:  whereHelpertime_Time{/* contains filtered or unexported fields */},
	Difficulty: whereHelperstring{/* contains filtered or unexported fields */},
	Topic:      whereHelperstring{/* contains filtered or unexported fields */},
	MoreInfo:   whereHelperstring{/* contains filtered or unexported fields */},
}
View Source
var TableNames = struct {
	Answers   string
	Choices   string
	Questions string
}{
	Answers:   "answers",
	Choices:   "choices",
	Questions: "questions",
}
View Source
var ViewNames = struct {
}{}

Functions

func AddAnswerHook

func AddAnswerHook(hookPoint boil.HookPoint, answerHook AnswerHook)

AddAnswerHook registers your hook function for all future operations.

func AddChoiceHook

func AddChoiceHook(hookPoint boil.HookPoint, choiceHook ChoiceHook)

AddChoiceHook registers your hook function for all future operations.

func AddQuestionHook

func AddQuestionHook(hookPoint boil.HookPoint, questionHook QuestionHook)

AddQuestionHook registers your hook function for all future operations.

func AnswerExists

func AnswerExists(ctx context.Context, exec boil.ContextExecutor, iD string) (bool, error)

AnswerExists checks if the Answer row exists.

func Answers

func Answers(mods ...qm.QueryMod) answerQuery

Answers retrieves all the records using an executor.

func ChoiceExists

func ChoiceExists(ctx context.Context, exec boil.ContextExecutor, iD string) (bool, error)

ChoiceExists checks if the Choice row exists.

func Choices

func Choices(mods ...qm.QueryMod) choiceQuery

Choices 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 QuestionExists

func QuestionExists(ctx context.Context, exec boil.ContextExecutor, iD string) (bool, error)

QuestionExists checks if the Question row exists.

func Questions

func Questions(mods ...qm.QueryMod) questionQuery

Questions retrieves all the records using an executor.

Types

type Answer

type Answer struct {
	ID        string    `boil:"id" json:"id" toml:"id" yaml:"id"`
	UserID    string    `boil:"user_id" json:"user_id" toml:"user_id" yaml:"user_id"`
	ChoiceID  string    `boil:"choice_id" json:"choice_id" toml:"choice_id" yaml:"choice_id"`
	CreatedAt time.Time `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`

	R *answerR `boil:"" json:"" toml:"" yaml:""`
	L answerL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Answer is an object representing the database table.

func FindAnswer

func FindAnswer(ctx context.Context, exec boil.ContextExecutor, iD string, selectCols ...string) (*Answer, error)

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

func (*Answer) Choice

func (o *Answer) Choice(mods ...qm.QueryMod) choiceQuery

Choice pointed to by the foreign key.

func (*Answer) Delete

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

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

func (*Answer) Exists

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

Exists checks if the Answer row exists.

func (*Answer) Insert

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

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

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

func (*Answer) SetChoice

func (o *Answer) SetChoice(ctx context.Context, exec boil.ContextExecutor, insert bool, related *Choice) error

SetChoice of the answer to the related item. Sets o.R.Choice to related. Adds o to related.R.Answers.

func (*Answer) Update

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

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

func (o *Answer) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns, opts ...UpsertOptionFunc) 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 AnswerHook

type AnswerHook func(context.Context, boil.ContextExecutor, *Answer) error

AnswerHook is the signature for custom Answer hook methods

type AnswerSlice

type AnswerSlice []*Answer

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

func (AnswerSlice) DeleteAll

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

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

func (*AnswerSlice) ReloadAll

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

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

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

type Choice

type Choice struct {
	ID         string    `boil:"id" json:"id" toml:"id" yaml:"id"`
	QuestionID string    `boil:"question_id" json:"question_id" toml:"question_id" yaml:"question_id"`
	Choice     string    `boil:"choice" json:"choice" toml:"choice" yaml:"choice"`
	IsCorrect  bool      `boil:"is_correct" json:"is_correct" toml:"is_correct" yaml:"is_correct"`
	CreatedAt  time.Time `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`

	R *choiceR `boil:"" json:"" toml:"" yaml:""`
	L choiceL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Choice is an object representing the database table.

func FindChoice

func FindChoice(ctx context.Context, exec boil.ContextExecutor, iD string, selectCols ...string) (*Choice, error)

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

func (*Choice) AddAnswers

func (o *Choice) AddAnswers(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*Answer) error

AddAnswers adds the given related objects to the existing relationships of the choice, optionally inserting them as new records. Appends related to o.R.Answers. Sets related.R.Choice appropriately.

func (*Choice) Answers

func (o *Choice) Answers(mods ...qm.QueryMod) answerQuery

Answers retrieves all the answer's Answers with an executor.

func (*Choice) Delete

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

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

func (*Choice) Exists

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

Exists checks if the Choice row exists.

func (*Choice) Insert

func (o *Choice) 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 (*Choice) Question

func (o *Choice) Question(mods ...qm.QueryMod) questionQuery

Question pointed to by the foreign key.

func (*Choice) Reload

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

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

func (*Choice) SetQuestion

func (o *Choice) SetQuestion(ctx context.Context, exec boil.ContextExecutor, insert bool, related *Question) error

SetQuestion of the choice to the related item. Sets o.R.Question to related. Adds o to related.R.Choices.

func (*Choice) Update

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

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

func (o *Choice) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns, opts ...UpsertOptionFunc) 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 ChoiceHook

type ChoiceHook func(context.Context, boil.ContextExecutor, *Choice) error

ChoiceHook is the signature for custom Choice hook methods

type ChoiceSlice

type ChoiceSlice []*Choice

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

func (ChoiceSlice) DeleteAll

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

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

func (*ChoiceSlice) ReloadAll

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

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

type Question struct {
	ID         string    `boil:"id" json:"id" toml:"id" yaml:"id"`
	Question   string    `boil:"question" json:"question" toml:"question" yaml:"question"`
	Hint       string    `boil:"hint" json:"hint" toml:"hint" yaml:"hint"`
	CreatedAt  time.Time `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
	Difficulty string    `boil:"difficulty" json:"difficulty" toml:"difficulty" yaml:"difficulty"`
	Topic      string    `boil:"topic" json:"topic" toml:"topic" yaml:"topic"`
	MoreInfo   string    `boil:"more_info" json:"more_info" toml:"more_info" yaml:"more_info"`

	R *questionR `boil:"" json:"" toml:"" yaml:""`
	L questionL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Question is an object representing the database table.

func FindQuestion

func FindQuestion(ctx context.Context, exec boil.ContextExecutor, iD string, selectCols ...string) (*Question, error)

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

func (*Question) AddChoices

func (o *Question) AddChoices(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*Choice) error

AddChoices adds the given related objects to the existing relationships of the question, optionally inserting them as new records. Appends related to o.R.Choices. Sets related.R.Question appropriately.

func (*Question) Choices

func (o *Question) Choices(mods ...qm.QueryMod) choiceQuery

Choices retrieves all the choice's Choices with an executor.

func (*Question) Delete

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

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

func (*Question) Exists

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

Exists checks if the Question row exists.

func (*Question) Insert

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

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

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

func (*Question) Update

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

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

func (o *Question) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns, opts ...UpsertOptionFunc) 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 QuestionHook

type QuestionHook func(context.Context, boil.ContextExecutor, *Question) error

QuestionHook is the signature for custom Question hook methods

type QuestionSlice

type QuestionSlice []*Question

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

func (QuestionSlice) DeleteAll

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

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

func (*QuestionSlice) ReloadAll

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

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

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

type UpsertOptionFunc

type UpsertOptionFunc func(o *UpsertOptions)

func UpsertConflictTarget

func UpsertConflictTarget(conflictTarget string) UpsertOptionFunc

func UpsertUpdateSet

func UpsertUpdateSet(updateSet string) UpsertOptionFunc

type UpsertOptions

type UpsertOptions struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL