models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PostTypeComic   = "comic"
	PostTypeScrote  = "scrote"
	PostTypeUnknown = "unknown"
)

Enum values for post_type

Variables

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 GuildColumns = struct {
	ID        string
	Snowflake string
	Emote     string
	CreatedAt string
	UpdatedAt string
}{
	ID:        "id",
	Snowflake: "snowflake",
	Emote:     "emote",
	CreatedAt: "created_at",
	UpdatedAt: "updated_at",
}
View Source
var GuildRels = struct {
	SnowflakePosts string
}{
	SnowflakePosts: "SnowflakePosts",
}

GuildRels is where relationship names are stored.

View Source
var GuildWhere = struct {
	ID        whereHelperint64
	Snowflake whereHelperstring
	Emote     whereHelpernull_String
	CreatedAt whereHelpertime_Time
	UpdatedAt whereHelpertime_Time
}{
	ID:        whereHelperint64{/* contains filtered or unexported fields */},
	Snowflake: whereHelperstring{/* contains filtered or unexported fields */},
	Emote:     whereHelpernull_String{/* contains filtered or unexported fields */},
	CreatedAt: whereHelpertime_Time{/* contains filtered or unexported fields */},
	UpdatedAt: whereHelpertime_Time{/* contains filtered or unexported fields */},
}
View Source
var PostColumns = struct {
	ID          string
	Snowflake   string
	Hash        string
	Path        string
	Type        string
	Title       string
	Description string
	CreatedAt   string
	UpdatedAt   string
}{
	ID:          "id",
	Snowflake:   "snowflake",
	Hash:        "hash",
	Path:        "path",
	Type:        "type",
	Title:       "title",
	Description: "description",
	CreatedAt:   "created_at",
	UpdatedAt:   "updated_at",
}
View Source
var PostRels = struct {
	SnowflakeGuild string
}{
	SnowflakeGuild: "SnowflakeGuild",
}

PostRels is where relationship names are stored.

View Source
var PostWhere = struct {
	ID          whereHelperint64
	Snowflake   whereHelperstring
	Hash        whereHelperstring
	Path        whereHelperstring
	Type        whereHelperstring
	Title       whereHelperstring
	Description whereHelpernull_String
	CreatedAt   whereHelpertime_Time
	UpdatedAt   whereHelpertime_Time
}{
	ID:          whereHelperint64{/* contains filtered or unexported fields */},
	Snowflake:   whereHelperstring{/* contains filtered or unexported fields */},
	Hash:        whereHelperstring{/* contains filtered or unexported fields */},
	Path:        whereHelperstring{/* contains filtered or unexported fields */},
	Type:        whereHelperstring{/* contains filtered or unexported fields */},
	Title:       whereHelperstring{/* contains filtered or unexported fields */},
	Description: whereHelpernull_String{/* contains filtered or unexported fields */},
	CreatedAt:   whereHelpertime_Time{/* contains filtered or unexported fields */},
	UpdatedAt:   whereHelpertime_Time{/* contains filtered or unexported fields */},
}
View Source
var TableNames = struct {
	Guilds string
	Posts  string
}{
	Guilds: "guilds",
	Posts:  "posts",
}

Functions

func GuildExists

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

GuildExists checks if the Guild row exists.

func Guilds

func Guilds(mods ...qm.QueryMod) guildQuery

Guilds 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.

Types

type Guild

type Guild struct {
	ID        int64       `boil:"id" json:"id" toml:"id" yaml:"id"`
	Snowflake string      `boil:"snowflake" json:"snowflake" toml:"snowflake" yaml:"snowflake"`
	Emote     null.String `boil:"emote" json:"emote,omitempty" toml:"emote" yaml:"emote,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"`

	R *guildR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L guildL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Guild is an object representing the database table.

func FindGuild

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

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

func (*Guild) AddSnowflakePosts

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

AddSnowflakePosts adds the given related objects to the existing relationships of the guild, optionally inserting them as new records. Appends related to o.R.SnowflakePosts. Sets related.R.SnowflakeGuild appropriately.

func (*Guild) Delete

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

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

func (*Guild) Insert

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

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

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

func (*Guild) SnowflakePosts

func (o *Guild) SnowflakePosts(mods ...qm.QueryMod) postQuery

SnowflakePosts retrieves all the post's Posts with an executor via snowflake column.

func (*Guild) Update

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

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

func (o *Guild) 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 GuildSlice

type GuildSlice []*Guild

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

func (GuildSlice) DeleteAll

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

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

func (*GuildSlice) ReloadAll

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

func (o GuildSlice) 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"`
	Snowflake   string      `boil:"snowflake" json:"snowflake" toml:"snowflake" yaml:"snowflake"`
	Hash        string      `boil:"hash" json:"hash" toml:"hash" yaml:"hash"`
	Path        string      `boil:"path" json:"path" toml:"path" yaml:"path"`
	Type        string      `boil:"type" json:"type" toml:"type" yaml:"type"`
	Title       string      `boil:"title" json:"title" toml:"title" yaml:"title"`
	Description null.String `boil:"description" json:"description,omitempty" toml:"description" yaml:"description,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"`

	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) SetSnowflakeGuild

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

SetSnowflakeGuild of the post to the related item. Sets o.R.SnowflakeGuild to related. Adds o to related.R.SnowflakePosts.

func (*Post) SnowflakeGuild

func (o *Post) SnowflakeGuild(mods ...qm.QueryMod) guildQuery

SnowflakeGuild pointed to by the foreign key.

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.

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.

Jump to

Keyboard shortcuts

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