dbmodel

package
v0.0.0-...-98da0ec Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommentColumns = struct {
	ID        string
	PostID    string
	Author    string
	Body      string
	Notes     string
	CreatedAt string
	UpdatedAt string
}{
	ID:        "id",
	PostID:    "post_id",
	Author:    "author",
	Body:      "body",
	Notes:     "notes",
	CreatedAt: "created_at",
	UpdatedAt: "updated_at",
}
View Source
var ErrSyncFail = errors.New("dbmodel: 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 PostColumns = struct {
	ID        string
	Title     string
	Author    string
	Body      string
	Notes     string
	CreatedAt string
	UpdatedAt string
}{
	ID:        "id",
	Title:     "title",
	Author:    "author",
	Body:      "body",
	Notes:     "notes",
	CreatedAt: "created_at",
	UpdatedAt: "updated_at",
}
View Source
var TableNames = struct {
	Comment string
	Post    string
}{
	Comment: "comment",
	Post:    "post",
}

Functions

func AddCommentHook

func AddCommentHook(hookPoint boil.HookPoint, commentHook CommentHook)

AddCommentHook registers your hook function for all future operations.

func AddPostHook

func AddPostHook(hookPoint boil.HookPoint, postHook PostHook)

AddPostHook registers your hook function for all future operations.

func CommentExists

func CommentExists(exec boil.Executor, id int) (bool, error)

CommentExists checks if the Comment row exists.

func CommentExistsG

func CommentExistsG(id int) (bool, error)

CommentExistsG checks if the Comment row exists.

func CommentExistsGP

func CommentExistsGP(id int) bool

CommentExistsGP checks if the Comment row exists. Panics on error.

func CommentExistsP

func CommentExistsP(exec boil.Executor, id int) bool

CommentExistsP checks if the Comment row exists. Panics on error.

func Comments

func Comments(exec boil.Executor, mods ...qm.QueryMod) commentQuery

Comments retrieves all the records using an executor.

func CommentsG

func CommentsG(mods ...qm.QueryMod) commentQuery

CommentsG retrieves all records.

func NewQuery

func NewQuery(exec boil.Executor, mods ...qm.QueryMod) *queries.Query

NewQuery initializes a new Query using the passed in QueryMods

func NewQueryG

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

NewQueryG initializes a new Query using the passed in QueryMods

func PostExists

func PostExists(exec boil.Executor, id int) (bool, error)

PostExists checks if the Post row exists.

func PostExistsG

func PostExistsG(id int) (bool, error)

PostExistsG checks if the Post row exists.

func PostExistsGP

func PostExistsGP(id int) bool

PostExistsGP checks if the Post row exists. Panics on error.

func PostExistsP

func PostExistsP(exec boil.Executor, id int) bool

PostExistsP checks if the Post row exists. Panics on error.

func Posts

func Posts(exec boil.Executor, mods ...qm.QueryMod) postQuery

Posts retrieves all the records using an executor.

func PostsG

func PostsG(mods ...qm.QueryMod) postQuery

PostsG retrieves all records.

Types

type Comment

type Comment struct {
	ID        int         `boil:"id" json:"id" toml:"id" yaml:"id"`
	PostID    int         `boil:"post_id" json:"post_id" toml:"post_id" yaml:"post_id"`
	Author    string      `boil:"author" json:"author" toml:"author" yaml:"author"`
	Body      string      `boil:"body" json:"body" toml:"body" yaml:"body"`
	Notes     null.String `boil:"notes" json:"notes,omitempty" toml:"notes" yaml:"notes,omitempty"`
	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"`

	R *commentR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L commentL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Comment is an object representing the database table.

func FindComment

func FindComment(exec boil.Executor, id int, selectCols ...string) (*Comment, error)

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

func FindCommentG

func FindCommentG(id int, selectCols ...string) (*Comment, error)

FindCommentG retrieves a single record by ID.

func FindCommentGP

func FindCommentGP(id int, selectCols ...string) *Comment

FindCommentGP retrieves a single record by ID, and panics on error.

func FindCommentP

func FindCommentP(exec boil.Executor, id int, selectCols ...string) *Comment

FindCommentP retrieves a single record by ID with an executor, and panics on error.

func (*Comment) Delete

func (o *Comment) Delete(exec boil.Executor) error

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

func (*Comment) DeleteG

func (o *Comment) DeleteG() error

DeleteG deletes a single Comment record. DeleteG will match against the primary key column to find the record to delete.

func (*Comment) DeleteGP

func (o *Comment) DeleteGP()

DeleteGP deletes a single Comment record. DeleteGP will match against the primary key column to find the record to delete. Panics on error.

func (*Comment) DeleteP

func (o *Comment) DeleteP(exec boil.Executor)

DeleteP deletes a single Comment record with an executor. DeleteP will match against the primary key column to find the record to delete. Panics on error.

func (*Comment) Insert

func (o *Comment) Insert(exec boil.Executor, whitelist ...string) error

Insert a single record using an executor. Whitelist behavior: If a whitelist is provided, only those columns supplied are inserted No whitelist behavior: Without a whitelist, columns are inferred by the following rules: - All columns without a default value are included (i.e. name, age) - All columns with a default, but non-zero are included (i.e. health = 75)

func (*Comment) InsertG

func (o *Comment) InsertG(whitelist ...string) error

InsertG a single record. See Insert for whitelist behavior description.

func (*Comment) InsertGP

func (o *Comment) InsertGP(whitelist ...string)

InsertGP a single record, and panics on error. See Insert for whitelist behavior description.

func (*Comment) InsertP

func (o *Comment) InsertP(exec boil.Executor, whitelist ...string)

InsertP a single record using an executor, and panics on error. See Insert for whitelist behavior description.

func (*Comment) Post

func (o *Comment) Post(exec boil.Executor, mods ...qm.QueryMod) postQuery

Post pointed to by the foreign key.

func (*Comment) PostG

func (o *Comment) PostG(mods ...qm.QueryMod) postQuery

PostG pointed to by the foreign key.

func (*Comment) Reload

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

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

func (*Comment) ReloadG

func (o *Comment) ReloadG() error

ReloadG refetches the object from the database using the primary keys.

func (*Comment) ReloadGP

func (o *Comment) ReloadGP()

ReloadGP refetches the object from the database and panics on error.

func (*Comment) ReloadP

func (o *Comment) ReloadP(exec boil.Executor)

ReloadP refetches the object from the database with an executor. Panics on error.

func (*Comment) SetPost

func (o *Comment) SetPost(exec boil.Executor, insert bool, related *Post) error

SetPost of the comment to the related item. Sets o.R.Post to related. Adds o to related.R.Comments.

func (*Comment) SetPostG

func (o *Comment) SetPostG(insert bool, related *Post) error

SetPostG of the comment to the related item. Sets o.R.Post to related. Adds o to related.R.Comments. Uses the global database handle.

func (*Comment) SetPostGP

func (o *Comment) SetPostGP(insert bool, related *Post)

SetPostGP of the comment to the related item. Sets o.R.Post to related. Adds o to related.R.Comments. Uses the global database handle and panics on error.

func (*Comment) SetPostP

func (o *Comment) SetPostP(exec boil.Executor, insert bool, related *Post)

SetPostP of the comment to the related item. Sets o.R.Post to related. Adds o to related.R.Comments. Panics on error.

func (*Comment) Update

func (o *Comment) Update(exec boil.Executor, whitelist ...string) error

Update uses an executor to update the Comment. Whitelist behavior: If a whitelist is provided, only the columns given are updated. No whitelist behavior: Without a whitelist, columns are inferred by the following rules: - All columns are inferred to start with - All primary keys are subtracted from this set Update does not automatically update the record in case of default values. Use .Reload() to refresh the records.

func (*Comment) UpdateG

func (o *Comment) UpdateG(whitelist ...string) error

UpdateG a single Comment record. See Update for whitelist behavior description.

func (*Comment) UpdateGP

func (o *Comment) UpdateGP(whitelist ...string)

UpdateGP a single Comment record. UpdateGP takes a whitelist of column names that should be updated. Panics on error. See Update for whitelist behavior description.

func (*Comment) UpdateP

func (o *Comment) UpdateP(exec boil.Executor, whitelist ...string)

UpdateP uses an executor to update the Comment, and panics on error. See Update for whitelist behavior description.

func (*Comment) Upsert

func (o *Comment) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error

Upsert attempts an insert using an executor, and does an update or ignore on conflict.

func (*Comment) UpsertG

func (o *Comment) UpsertG(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error

UpsertG attempts an insert, and does an update or ignore on conflict.

func (*Comment) UpsertGP

func (o *Comment) UpsertGP(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string)

UpsertGP attempts an insert, and does an update or ignore on conflict. Panics on error.

func (*Comment) UpsertP

func (o *Comment) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string)

UpsertP attempts an insert using an executor, and does an update or ignore on conflict. UpsertP panics on error.

type CommentHook

type CommentHook func(boil.Executor, *Comment) error

CommentHook is the signature for custom Comment hook methods

type CommentSlice

type CommentSlice []*Comment

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

func (CommentSlice) DeleteAll

func (o CommentSlice) DeleteAll(exec boil.Executor) error

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

func (CommentSlice) DeleteAllG

func (o CommentSlice) DeleteAllG() error

DeleteAllG deletes all rows in the slice.

func (CommentSlice) DeleteAllGP

func (o CommentSlice) DeleteAllGP()

DeleteAllGP deletes all rows in the slice, and panics on error.

func (CommentSlice) DeleteAllP

func (o CommentSlice) DeleteAllP(exec boil.Executor)

DeleteAllP deletes all rows in the slice, using an executor, and panics on error.

func (*CommentSlice) ReloadAll

func (o *CommentSlice) 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 (*CommentSlice) ReloadAllG

func (o *CommentSlice) ReloadAllG() error

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

func (*CommentSlice) ReloadAllGP

func (o *CommentSlice) ReloadAllGP()

ReloadAllGP refetches every row with matching primary key column values and overwrites the original object slice with the newly updated slice. Panics on error.

func (*CommentSlice) ReloadAllP

func (o *CommentSlice) ReloadAllP(exec boil.Executor)

ReloadAllP refetches every row with matching primary key column values and overwrites the original object slice with the newly updated slice. Panics on error.

func (CommentSlice) UpdateAll

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

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

func (CommentSlice) UpdateAllG

func (o CommentSlice) UpdateAllG(cols M) error

UpdateAllG updates all rows with the specified column values.

func (CommentSlice) UpdateAllGP

func (o CommentSlice) UpdateAllGP(cols M)

UpdateAllGP updates all rows with the specified column values, and panics on error.

func (CommentSlice) UpdateAllP

func (o CommentSlice) UpdateAllP(exec boil.Executor, cols M)

UpdateAllP updates all rows with the specified column values, and panics on error.

type M

type M map[string]interface{}

M type is for providing columns and column values to UpdateAll.

type Post

type Post struct {
	ID        int         `boil:"id" json:"id" toml:"id" yaml:"id"`
	Title     string      `boil:"title" json:"title" toml:"title" yaml:"title"`
	Author    string      `boil:"author" json:"author" toml:"author" yaml:"author"`
	Body      string      `boil:"body" json:"body" toml:"body" yaml:"body"`
	Notes     null.String `boil:"notes" json:"notes,omitempty" toml:"notes" yaml:"notes,omitempty"`
	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"`

	R *postR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L postL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Post is an object representing the database table.

func FindPost

func FindPost(exec boil.Executor, id int, selectCols ...string) (*Post, error)

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

func FindPostG

func FindPostG(id int, selectCols ...string) (*Post, error)

FindPostG retrieves a single record by ID.

func FindPostGP

func FindPostGP(id int, selectCols ...string) *Post

FindPostGP retrieves a single record by ID, and panics on error.

func FindPostP

func FindPostP(exec boil.Executor, id int, selectCols ...string) *Post

FindPostP retrieves a single record by ID with an executor, and panics on error.

func (*Post) AddComments

func (o *Post) AddComments(exec boil.Executor, insert bool, related ...*Comment) error

AddComments adds the given related objects to the existing relationships of the post, optionally inserting them as new records. Appends related to o.R.Comments. Sets related.R.Post appropriately.

func (*Post) AddCommentsG

func (o *Post) AddCommentsG(insert bool, related ...*Comment) error

AddCommentsG adds the given related objects to the existing relationships of the post, optionally inserting them as new records. Appends related to o.R.Comments. Sets related.R.Post appropriately. Uses the global database handle.

func (*Post) AddCommentsGP

func (o *Post) AddCommentsGP(insert bool, related ...*Comment)

AddCommentsGP adds the given related objects to the existing relationships of the post, optionally inserting them as new records. Appends related to o.R.Comments. Sets related.R.Post appropriately. Uses the global database handle and panics on error.

func (*Post) AddCommentsP

func (o *Post) AddCommentsP(exec boil.Executor, insert bool, related ...*Comment)

AddCommentsP adds the given related objects to the existing relationships of the post, optionally inserting them as new records. Appends related to o.R.Comments. Sets related.R.Post appropriately. Panics on error.

func (*Post) Comments

func (o *Post) Comments(exec boil.Executor, mods ...qm.QueryMod) commentQuery

Comments retrieves all the comment's comment with an executor.

func (*Post) CommentsG

func (o *Post) CommentsG(mods ...qm.QueryMod) commentQuery

CommentsG retrieves all the comment's comment.

func (*Post) Delete

func (o *Post) Delete(exec boil.Executor) error

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

func (*Post) DeleteG

func (o *Post) DeleteG() error

DeleteG deletes a single Post record. DeleteG will match against the primary key column to find the record to delete.

func (*Post) DeleteGP

func (o *Post) DeleteGP()

DeleteGP deletes a single Post record. DeleteGP will match against the primary key column to find the record to delete. Panics on error.

func (*Post) DeleteP

func (o *Post) DeleteP(exec boil.Executor)

DeleteP deletes a single Post record with an executor. DeleteP will match against the primary key column to find the record to delete. Panics on error.

func (*Post) Insert

func (o *Post) Insert(exec boil.Executor, whitelist ...string) error

Insert a single record using an executor. Whitelist behavior: If a whitelist is provided, only those columns supplied are inserted No whitelist behavior: Without a whitelist, columns are inferred by the following rules: - All columns without a default value are included (i.e. name, age) - All columns with a default, but non-zero are included (i.e. health = 75)

func (*Post) InsertG

func (o *Post) InsertG(whitelist ...string) error

InsertG a single record. See Insert for whitelist behavior description.

func (*Post) InsertGP

func (o *Post) InsertGP(whitelist ...string)

InsertGP a single record, and panics on error. See Insert for whitelist behavior description.

func (*Post) InsertP

func (o *Post) InsertP(exec boil.Executor, whitelist ...string)

InsertP a single record using an executor, and panics on error. See Insert for whitelist behavior description.

func (*Post) Reload

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

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

func (*Post) ReloadG

func (o *Post) ReloadG() error

ReloadG refetches the object from the database using the primary keys.

func (*Post) ReloadGP

func (o *Post) ReloadGP()

ReloadGP refetches the object from the database and panics on error.

func (*Post) ReloadP

func (o *Post) ReloadP(exec boil.Executor)

ReloadP refetches the object from the database with an executor. Panics on error.

func (*Post) Update

func (o *Post) Update(exec boil.Executor, whitelist ...string) error

Update uses an executor to update the Post. Whitelist behavior: If a whitelist is provided, only the columns given are updated. No whitelist behavior: Without a whitelist, columns are inferred by the following rules: - All columns are inferred to start with - All primary keys are subtracted from this set Update does not automatically update the record in case of default values. Use .Reload() to refresh the records.

func (*Post) UpdateG

func (o *Post) UpdateG(whitelist ...string) error

UpdateG a single Post record. See Update for whitelist behavior description.

func (*Post) UpdateGP

func (o *Post) UpdateGP(whitelist ...string)

UpdateGP a single Post record. UpdateGP takes a whitelist of column names that should be updated. Panics on error. See Update for whitelist behavior description.

func (*Post) UpdateP

func (o *Post) UpdateP(exec boil.Executor, whitelist ...string)

UpdateP uses an executor to update the Post, and panics on error. See Update for whitelist behavior description.

func (*Post) Upsert

func (o *Post) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error

Upsert attempts an insert using an executor, and does an update or ignore on conflict.

func (*Post) UpsertG

func (o *Post) UpsertG(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error

UpsertG attempts an insert, and does an update or ignore on conflict.

func (*Post) UpsertGP

func (o *Post) UpsertGP(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string)

UpsertGP attempts an insert, and does an update or ignore on conflict. Panics on error.

func (*Post) UpsertP

func (o *Post) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string)

UpsertP attempts an insert using an executor, and does an update or ignore on conflict. UpsertP panics on error.

type PostHook

type PostHook func(boil.Executor, *Post) error

PostHook is the signature for custom Post hook methods

type PostSlice

type PostSlice []*Post

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

func (PostSlice) DeleteAll

func (o PostSlice) DeleteAll(exec boil.Executor) error

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

func (PostSlice) DeleteAllG

func (o PostSlice) DeleteAllG() error

DeleteAllG deletes all rows in the slice.

func (PostSlice) DeleteAllGP

func (o PostSlice) DeleteAllGP()

DeleteAllGP deletes all rows in the slice, and panics on error.

func (PostSlice) DeleteAllP

func (o PostSlice) DeleteAllP(exec boil.Executor)

DeleteAllP deletes all rows in the slice, using an executor, and panics on error.

func (*PostSlice) ReloadAll

func (o *PostSlice) 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 (*PostSlice) ReloadAllG

func (o *PostSlice) ReloadAllG() error

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

func (*PostSlice) ReloadAllGP

func (o *PostSlice) ReloadAllGP()

ReloadAllGP refetches every row with matching primary key column values and overwrites the original object slice with the newly updated slice. Panics on error.

func (*PostSlice) ReloadAllP

func (o *PostSlice) ReloadAllP(exec boil.Executor)

ReloadAllP refetches every row with matching primary key column values and overwrites the original object slice with the newly updated slice. Panics on error.

func (PostSlice) UpdateAll

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

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

func (PostSlice) UpdateAllG

func (o PostSlice) UpdateAllG(cols M) error

UpdateAllG updates all rows with the specified column values.

func (PostSlice) UpdateAllGP

func (o PostSlice) UpdateAllGP(cols M)

UpdateAllGP updates all rows with the specified column values, and panics on error.

func (PostSlice) UpdateAllP

func (o PostSlice) UpdateAllP(exec boil.Executor, cols M)

UpdateAllP updates all rows with the specified column values, and panics on error.

Jump to

Keyboard shortcuts

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