dbmodel

package
v0.0.0-...-e28ac33 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ArticleColumns = struct {
	ArticleID      string
	Title          string
	Body           string
	Description    string
	PublishStatus  string
	ThumbnailImage string
	PostedAt       string
	CreatedAt      string
	UpdatedAt      string
}{
	ArticleID:      "article_id",
	Title:          "title",
	Body:           "body",
	Description:    "description",
	PublishStatus:  "publish_status",
	ThumbnailImage: "thumbnail_image",
	PostedAt:       "posted_at",
	CreatedAt:      "created_at",
	UpdatedAt:      "updated_at",
}
View Source
var ArticleRels = struct {
}{}

ArticleRels is where relationship names are stored.

View Source
var ArticleWhere = struct {
	ArticleID      whereHelperint
	Title          whereHelperstring
	Body           whereHelperstring
	Description    whereHelperstring
	PublishStatus  whereHelperint
	ThumbnailImage whereHelperstring
	PostedAt       whereHelpertime_Time
	CreatedAt      whereHelpertime_Time
	UpdatedAt      whereHelpertime_Time
}{
	ArticleID:      whereHelperint{/* contains filtered or unexported fields */},
	Title:          whereHelperstring{/* contains filtered or unexported fields */},
	Body:           whereHelperstring{/* contains filtered or unexported fields */},
	Description:    whereHelperstring{/* contains filtered or unexported fields */},
	PublishStatus:  whereHelperint{/* contains filtered or unexported fields */},
	ThumbnailImage: whereHelperstring{/* contains filtered or unexported fields */},
	PostedAt:       whereHelpertime_Time{/* contains filtered or unexported fields */},
	CreatedAt:      whereHelpertime_Time{/* contains filtered or unexported fields */},
	UpdatedAt:      whereHelpertime_Time{/* contains filtered or unexported fields */},
}
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 TableNames = struct {
	Articles string
}{
	Articles: "articles",
}

Functions

func AddArticleHook

func AddArticleHook(hookPoint boil.HookPoint, articleHook ArticleHook)

AddArticleHook registers your hook function for all future operations.

func ArticleExists

func ArticleExists(ctx context.Context, exec boil.ContextExecutor, articleID int) (bool, error)

ArticleExists checks if the Article row exists.

func ArticleExistsG

func ArticleExistsG(ctx context.Context, articleID int) (bool, error)

ArticleExistsG checks if the Article row exists.

func Articles

func Articles(mods ...qm.QueryMod) articleQuery

Articles 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

Types

type Article

type Article struct {
	ArticleID      int       `boil:"article_id" json:"article_id" toml:"article_id" yaml:"article_id"`
	Title          string    `boil:"title" json:"title" toml:"title" yaml:"title"`
	Body           string    `boil:"body" json:"body" toml:"body" yaml:"body"`
	Description    string    `boil:"description" json:"description" toml:"description" yaml:"description"`
	PublishStatus  int       `boil:"publish_status" json:"publish_status" toml:"publish_status" yaml:"publish_status"`
	ThumbnailImage string    `boil:"thumbnail_image" json:"thumbnail_image" toml:"thumbnail_image" yaml:"thumbnail_image"`
	PostedAt       time.Time `boil:"posted_at" json:"posted_at" toml:"posted_at" yaml:"posted_at"`
	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 *articleR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L articleL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Article is an object representing the database table.

func FindArticle

func FindArticle(ctx context.Context, exec boil.ContextExecutor, articleID int, selectCols ...string) (*Article, error)

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

func FindArticleG

func FindArticleG(ctx context.Context, articleID int, selectCols ...string) (*Article, error)

FindArticleG retrieves a single record by ID.

func (*Article) Delete

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

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

func (*Article) DeleteG

func (o *Article) DeleteG(ctx context.Context) (int64, error)

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

func (*Article) Insert

func (o *Article) 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 (*Article) InsertG

func (o *Article) InsertG(ctx context.Context, columns boil.Columns) error

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

func (*Article) Reload

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

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

func (*Article) ReloadG

func (o *Article) ReloadG(ctx context.Context) error

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

func (*Article) Update

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

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

func (o *Article) UpdateG(ctx context.Context, columns boil.Columns) (int64, error)

UpdateG a single Article record using the global executor. See Update for more documentation.

func (*Article) Upsert

func (o *Article) Upsert(ctx context.Context, exec boil.ContextExecutor, 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 (*Article) UpsertG

func (o *Article) UpsertG(ctx context.Context, updateColumns, insertColumns boil.Columns) error

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

type ArticleHook

type ArticleHook func(context.Context, boil.ContextExecutor, *Article) error

ArticleHook is the signature for custom Article hook methods

type ArticleLoader

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

ArticleLoader batches and caches requests

func NewArticleLoader

func NewArticleLoader(config ArticleLoaderConfig) *ArticleLoader

NewArticleLoader creates a new ArticleLoader given a fetch, wait, and maxBatch

func (*ArticleLoader) Clear

func (l *ArticleLoader) Clear(key int)

Clear the value at key from the cache, if it exists

func (*ArticleLoader) Load

func (l *ArticleLoader) Load(key int) (*Article, error)

Load a Article by key, batching and caching will be applied automatically

func (*ArticleLoader) LoadAll

func (l *ArticleLoader) LoadAll(keys []int) ([]*Article, []error)

LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured

func (*ArticleLoader) LoadAllThunk

func (l *ArticleLoader) LoadAllThunk(keys []int) func() ([]*Article, []error)

LoadAllThunk returns a function that when called will block waiting for a Articles. This method should be used if you want one goroutine to make requests to many different data loaders without blocking until the thunk is called.

func (*ArticleLoader) LoadThunk

func (l *ArticleLoader) LoadThunk(key int) func() (*Article, error)

LoadThunk returns a function that when called will block waiting for a Article. This method should be used if you want one goroutine to make requests to many different data loaders without blocking until the thunk is called.

func (*ArticleLoader) Prime

func (l *ArticleLoader) Prime(key int, value *Article) bool

Prime the cache with the provided key and value. If the key already exists, no change is made and false is returned. (To forcefully prime the cache, clear the key first with loader.clear(key).prime(key, value).)

type ArticleLoaderConfig

type ArticleLoaderConfig struct {
	// Fetch is a method that provides the data for the loader
	Fetch func(keys []int) ([]*Article, []error)

	// Wait is how long wait before sending a batch
	Wait time.Duration

	// MaxBatch will limit the maximum number of keys to send in one batch, 0 = not limit
	MaxBatch int
}

ArticleLoaderConfig captures the config to create a new ArticleLoader

type ArticleSlice

type ArticleSlice []*Article

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

func (ArticleSlice) DeleteAll

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

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

func (ArticleSlice) DeleteAllG

func (o ArticleSlice) DeleteAllG(ctx context.Context) (int64, error)

DeleteAllG deletes all rows in the slice.

func (*ArticleSlice) ReloadAll

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

func (o *ArticleSlice) ReloadAllG(ctx context.Context) error

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

func (ArticleSlice) UpdateAll

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

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

func (ArticleSlice) UpdateAllG

func (o ArticleSlice) UpdateAllG(ctx context.Context, cols M) (int64, error)

UpdateAllG updates all rows with the specified column values.

type ArticleSliceLoader

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

ArticleSliceLoader batches and caches requests

func NewArticleSliceLoader

func NewArticleSliceLoader(config ArticleSliceLoaderConfig) *ArticleSliceLoader

NewArticleSliceLoader creates a new ArticleSliceLoader given a fetch, wait, and maxBatch

func (*ArticleSliceLoader) Clear

func (l *ArticleSliceLoader) Clear(key int)

Clear the value at key from the cache, if it exists

func (*ArticleSliceLoader) Load

func (l *ArticleSliceLoader) Load(key int) ([]*Article, error)

Load a Article by key, batching and caching will be applied automatically

func (*ArticleSliceLoader) LoadAll

func (l *ArticleSliceLoader) LoadAll(keys []int) ([][]*Article, []error)

LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured

func (*ArticleSliceLoader) LoadAllThunk

func (l *ArticleSliceLoader) LoadAllThunk(keys []int) func() ([][]*Article, []error)

LoadAllThunk returns a function that when called will block waiting for a Articles. This method should be used if you want one goroutine to make requests to many different data loaders without blocking until the thunk is called.

func (*ArticleSliceLoader) LoadThunk

func (l *ArticleSliceLoader) LoadThunk(key int) func() ([]*Article, error)

LoadThunk returns a function that when called will block waiting for a Article. This method should be used if you want one goroutine to make requests to many different data loaders without blocking until the thunk is called.

func (*ArticleSliceLoader) Prime

func (l *ArticleSliceLoader) Prime(key int, value []*Article) bool

Prime the cache with the provided key and value. If the key already exists, no change is made and false is returned. (To forcefully prime the cache, clear the key first with loader.clear(key).prime(key, value).)

type ArticleSliceLoaderConfig

type ArticleSliceLoaderConfig struct {
	// Fetch is a method that provides the data for the loader
	Fetch func(keys []int) ([][]*Article, []error)

	// Wait is how long wait before sending a batch
	Wait time.Duration

	// MaxBatch will limit the maximum number of keys to send in one batch, 0 = not limit
	MaxBatch int
}

ArticleSliceLoaderConfig captures the config to create a new ArticleSliceLoader

type M

type M map[string]interface{}

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

Jump to

Keyboard shortcuts

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