orm

package
v0.0.0-...-a86c0ec Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSyncFail = errors.New("orm: 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 FollowingColumns = struct {
	ID              string
	FollowingUserID string
	FollowerID      string
}{
	ID:              "id",
	FollowingUserID: "following_user_id",
	FollowerID:      "follower_id",
}
View Source
var FollowingRels = struct {
}{}

FollowingRels is where relationship names are stored.

View Source
var FollowingWhere = struct {
	ID              whereHelperint64
	FollowingUserID whereHelperint
	FollowerID      whereHelperint
}{
	ID:              whereHelperint64{/* contains filtered or unexported fields */},
	FollowingUserID: whereHelperint{/* contains filtered or unexported fields */},
	FollowerID:      whereHelperint{/* contains filtered or unexported fields */},
}
View Source
var PostColumns = struct {
	ID        string
	UserID    string
	Content   string
	CreatedAt string
	UpdatedAt string
	IDToken   string
}{
	ID:        "id",
	UserID:    "user_id",
	Content:   "content",
	CreatedAt: "created_at",
	UpdatedAt: "updated_at",
	IDToken:   "id_token",
}
View Source
var PostRels = struct {
	User string
}{
	User: "User",
}

PostRels is where relationship names are stored.

View Source
var PostWhere = struct {
	ID        whereHelperint64
	UserID    whereHelpernull_Int64
	Content   whereHelperstring
	CreatedAt whereHelpertime_Time
	UpdatedAt whereHelpertime_Time
	IDToken   whereHelperstring
}{
	ID:        whereHelperint64{/* contains filtered or unexported fields */},
	UserID:    whereHelpernull_Int64{/* contains filtered or unexported fields */},
	Content:   whereHelperstring{/* contains filtered or unexported fields */},
	CreatedAt: whereHelpertime_Time{/* contains filtered or unexported fields */},
	UpdatedAt: whereHelpertime_Time{/* contains filtered or unexported fields */},
	IDToken:   whereHelperstring{/* contains filtered or unexported fields */},
}
View Source
var TableNames = struct {
	Followings string
	Posts      string
	Users      string
}{
	Followings: "followings",
	Posts:      "posts",
	Users:      "users",
}
View Source
var UserColumns = struct {
	ID                          string
	Email                       string
	CryptedPassword             string
	Salt                        string
	CreatedAt                   string
	UpdatedAt                   string
	RememberMeToken             string
	RememberMeTokenExpiresAt    string
	ResetPasswordToken          string
	ResetPasswordTokenExpiresAt string
	ResetPasswordEmailSentAt    string
	Name                        string
	ScreenName                  string
	Code                        string
}{
	ID:                          "id",
	Email:                       "email",
	CryptedPassword:             "crypted_password",
	Salt:                        "salt",
	CreatedAt:                   "created_at",
	UpdatedAt:                   "updated_at",
	RememberMeToken:             "remember_me_token",
	RememberMeTokenExpiresAt:    "remember_me_token_expires_at",
	ResetPasswordToken:          "reset_password_token",
	ResetPasswordTokenExpiresAt: "reset_password_token_expires_at",
	ResetPasswordEmailSentAt:    "reset_password_email_sent_at",
	Name:                        "name",
	ScreenName:                  "screen_name",
	Code:                        "code",
}
View Source
var UserRels = struct {
	Posts string
}{
	Posts: "Posts",
}

UserRels is where relationship names are stored.

View Source
var UserWhere = struct {
	ID                          whereHelperint64
	Email                       whereHelperstring
	CryptedPassword             whereHelpernull_String
	Salt                        whereHelpernull_String
	CreatedAt                   whereHelpertime_Time
	UpdatedAt                   whereHelpertime_Time
	RememberMeToken             whereHelpernull_String
	RememberMeTokenExpiresAt    whereHelpernull_Time
	ResetPasswordToken          whereHelpernull_String
	ResetPasswordTokenExpiresAt whereHelpernull_Time
	ResetPasswordEmailSentAt    whereHelpernull_Time
	Name                        whereHelpernull_String
	ScreenName                  whereHelperstring
	Code                        whereHelpernull_String
}{
	ID:                          whereHelperint64{/* contains filtered or unexported fields */},
	Email:                       whereHelperstring{/* contains filtered or unexported fields */},
	CryptedPassword:             whereHelpernull_String{/* contains filtered or unexported fields */},
	Salt:                        whereHelpernull_String{/* contains filtered or unexported fields */},
	CreatedAt:                   whereHelpertime_Time{/* contains filtered or unexported fields */},
	UpdatedAt:                   whereHelpertime_Time{/* contains filtered or unexported fields */},
	RememberMeToken:             whereHelpernull_String{/* contains filtered or unexported fields */},
	RememberMeTokenExpiresAt:    whereHelpernull_Time{/* contains filtered or unexported fields */},
	ResetPasswordToken:          whereHelpernull_String{/* contains filtered or unexported fields */},
	ResetPasswordTokenExpiresAt: whereHelpernull_Time{/* contains filtered or unexported fields */},
	ResetPasswordEmailSentAt:    whereHelpernull_Time{/* contains filtered or unexported fields */},
	Name:                        whereHelpernull_String{/* contains filtered or unexported fields */},
	ScreenName:                  whereHelperstring{/* contains filtered or unexported fields */},
	Code:                        whereHelpernull_String{/* contains filtered or unexported fields */},
}

Functions

func AddFollowingHook

func AddFollowingHook(hookPoint boil.HookPoint, followingHook FollowingHook)

AddFollowingHook 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 AddUserHook

func AddUserHook(hookPoint boil.HookPoint, userHook UserHook)

AddUserHook registers your hook function for all future operations.

func FollowingExists

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

FollowingExists checks if the Following row exists.

func Followings

func Followings(mods ...qm.QueryMod) followingQuery

Followings 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 PostExists

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

PostExists checks if the Post row exists.

func Posts

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

Posts retrieves all the records using an executor.

func UserExists

func UserExists(ctx context.Context, exec boil.ContextExecutor, iD int64) (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 Following

type Following struct {
	ID              int64 `boil:"id" json:"id" toml:"id" yaml:"id"`
	FollowingUserID int   `boil:"following_user_id" json:"following_user_id" toml:"following_user_id" yaml:"following_user_id"`
	FollowerID      int   `boil:"follower_id" json:"follower_id" toml:"follower_id" yaml:"follower_id"`

	R *followingR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L followingL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Following is an object representing the database table.

func FindFollowing

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

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

func (*Following) Delete

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

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

func (*Following) Insert

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

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

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

func (*Following) Update

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

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

func (o *Following) 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 FollowingHook

type FollowingHook func(context.Context, boil.ContextExecutor, *Following) error

FollowingHook is the signature for custom Following hook methods

type FollowingSlice

type FollowingSlice []*Following

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

func (FollowingSlice) DeleteAll

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

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

func (*FollowingSlice) ReloadAll

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

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

type Post struct {
	ID        int64      `boil:"id" json:"id" toml:"id" yaml:"id"`
	UserID    null.Int64 `boil:"user_id" json:"user_id,omitempty" toml:"user_id" yaml:"user_id,omitempty"`
	Content   string     `boil:"content" json:"content" toml:"content" yaml:"content"`
	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"`
	IDToken   string     `boil:"id_token" json:"id_token" toml:"id_token" yaml:"id_token"`

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

Post is an object representing the database table.

func FindPost

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

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

func (*Post) Delete

func (o *Post) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, 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) Insert

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

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

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

func (*Post) RemoveUser

func (o *Post) RemoveUser(ctx context.Context, exec boil.ContextExecutor, related *User) error

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

func (*Post) SetUser

func (o *Post) SetUser(ctx context.Context, exec boil.ContextExecutor, insert bool, related *User) error

SetUser of the post to the related item. Sets o.R.User to related. Adds o to related.R.Posts.

func (*Post) Update

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

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

func (o *Post) 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.

func (*Post) User

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

User pointed to by the foreign key.

type PostHook

type PostHook func(context.Context, boil.ContextExecutor, *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(ctx context.Context, exec boil.ContextExecutor) (int64, error)

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

func (*PostSlice) ReloadAll

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

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

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

type User

type User struct {
	ID                          int64       `boil:"id" json:"id" toml:"id" yaml:"id"`
	Email                       string      `boil:"email" json:"email" toml:"email" yaml:"email"`
	CryptedPassword             null.String `boil:"crypted_password" json:"crypted_password,omitempty" toml:"crypted_password" yaml:"crypted_password,omitempty"`
	Salt                        null.String `boil:"salt" json:"salt,omitempty" toml:"salt" yaml:"salt,omitempty"`
	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"`
	RememberMeToken             null.String `boil:"remember_me_token" json:"remember_me_token,omitempty" toml:"remember_me_token" yaml:"remember_me_token,omitempty"`
	RememberMeTokenExpiresAt    null.Time   `` /* 163-byte string literal not displayed */
	ResetPasswordToken          null.String `` /* 131-byte string literal not displayed */
	ResetPasswordTokenExpiresAt null.Time   `` /* 175-byte string literal not displayed */
	ResetPasswordEmailSentAt    null.Time   `` /* 163-byte string literal not displayed */
	Name                        null.String `boil:"name" json:"name,omitempty" toml:"name" yaml:"name,omitempty"`
	ScreenName                  string      `boil:"screen_name" json:"screen_name" toml:"screen_name" yaml:"screen_name"`
	Code                        null.String `boil:"code" json:"code,omitempty" toml:"code" yaml:"code,omitempty"`

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

User is an object representing the database table.

func FindUser

func FindUser(ctx context.Context, exec boil.ContextExecutor, iD int64, 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) AddPosts

func (o *User) AddPosts(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*Post) error

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

func (*User) Delete

func (o *User) Delete(ctx context.Context, exec boil.ContextExecutor) (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) Insert

func (o *User) 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 (*User) Posts

func (o *User) Posts(mods ...qm.QueryMod) postQuery

Posts retrieves all the post's Posts with an executor.

func (*User) Reload

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

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

func (*User) RemovePosts

func (o *User) RemovePosts(ctx context.Context, exec boil.ContextExecutor, related ...*Post) error

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

func (*User) SetPosts

func (o *User) SetPosts(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*Post) error

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

func (*User) Update

func (o *User) Update(ctx context.Context, exec boil.ContextExecutor, 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(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 UserHook

type UserHook func(context.Context, boil.ContextExecutor, *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(ctx context.Context, exec boil.ContextExecutor) (int64, error)

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

func (*UserSlice) ReloadAll

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

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