Documentation ¶
Index ¶
- func BottleFilterByAccount(accountID int, originaldb *gorm.DB) func(db *gorm.DB) *gorm.DB
- type Account
- type AccountDB
- func (m *AccountDB) Add(ctx context.Context, model *Account) error
- func (m *AccountDB) DB() interface{}
- func (m *AccountDB) Delete(ctx context.Context, id int) error
- func (m *AccountDB) Get(ctx context.Context, id int) (*Account, error)
- func (m *AccountDB) List(ctx context.Context) ([]*Account, error)
- func (m *AccountDB) ListAccount(ctx context.Context) []*app.Account
- func (m *AccountDB) ListAccountLink(ctx context.Context) []*app.AccountLink
- func (m *AccountDB) ListAccountTiny(ctx context.Context) []*app.AccountTiny
- func (m *AccountDB) OneAccount(ctx context.Context, id int) (*app.Account, error)
- func (m *AccountDB) OneAccountLink(ctx context.Context, id int) (*app.AccountLink, error)
- func (m *AccountDB) OneAccountTiny(ctx context.Context, id int) (*app.AccountTiny, error)
- func (m *AccountDB) TableName() string
- func (m *AccountDB) Update(ctx context.Context, model *Account) error
- type AccountStorage
- type Bottle
- type BottleDB
- func (m *BottleDB) Add(ctx context.Context, model *Bottle) error
- func (m *BottleDB) DB() interface{}
- func (m *BottleDB) Delete(ctx context.Context, id int) error
- func (m *BottleDB) Get(ctx context.Context, id int) (*Bottle, error)
- func (m *BottleDB) List(ctx context.Context) ([]*Bottle, error)
- func (m *BottleDB) ListBottle(ctx context.Context, accountID int) []*app.Bottle
- func (m *BottleDB) ListBottleByYears(ctx context.Context, accountID int, years []int) (bottles []*app.Bottle, err error)
- func (m *BottleDB) ListBottleFull(ctx context.Context, accountID int) []*app.BottleFull
- func (m *BottleDB) ListBottleTiny(ctx context.Context, accountID int) []*app.BottleTiny
- func (m *BottleDB) OneBottle(ctx context.Context, id int, accountID int) (*app.Bottle, error)
- func (m *BottleDB) OneBottleFull(ctx context.Context, id int, accountID int) (*app.BottleFull, error)
- func (m *BottleDB) OneBottleTiny(ctx context.Context, id int, accountID int) (*app.BottleTiny, error)
- func (m *BottleDB) TableName() string
- func (m *BottleDB) Update(ctx context.Context, model *Bottle) error
- func (m *BottleDB) UpdateFromBottlePayload(ctx context.Context, payload *app.BottlePayload, id int) error
- func (m *BottleDB) UpdateFromCreateBottlePayload(ctx context.Context, payload *app.CreateBottlePayload, id int) error
- type BottleStorage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Account ¶
type Account struct { ID int `gorm:"primary_key"` // primary key Bottles []Bottle // has many Bottles CreatedAt time.Time DeletedAt *time.Time Name string UpdatedAt time.Time }
Cellar Account
func (*Account) AccountToAccount ¶
AccountToAccount loads a Account and builds the default view of media type Account.
func (*Account) AccountToAccountLink ¶
func (m *Account) AccountToAccountLink() *app.AccountLink
AccountToAccountLink loads a Account and builds the link view of media type Account.
func (*Account) AccountToAccountTiny ¶
func (m *Account) AccountToAccountTiny() *app.AccountTiny
AccountToAccountTiny loads a Account and builds the tiny view of media type Account.
type AccountDB ¶
AccountDB is the implementation of the storage interface for Account.
func NewAccountDB ¶
NewAccountDB creates a new storage type.
func (*AccountDB) Get ¶
Get returns a single Account as a Database Model This is more for use internally, and probably not what you want in your controllers
func (*AccountDB) ListAccount ¶
ListAccount returns an array of view: default.
func (*AccountDB) ListAccountLink ¶
func (m *AccountDB) ListAccountLink(ctx context.Context) []*app.AccountLink
ListAccountLink returns an array of view: link.
func (*AccountDB) ListAccountTiny ¶
func (m *AccountDB) ListAccountTiny(ctx context.Context) []*app.AccountTiny
ListAccountTiny returns an array of view: tiny.
func (*AccountDB) OneAccount ¶
OneAccount loads a Account and builds the default view of media type Account.
func (*AccountDB) OneAccountLink ¶
OneAccountLink loads a Account and builds the link view of media type Account.
func (*AccountDB) OneAccountTiny ¶
OneAccountTiny loads a Account and builds the tiny view of media type Account.
type AccountStorage ¶
type AccountStorage interface { DB() interface{} List(ctx context.Context) ([]*Account, error) Get(ctx context.Context, id int) (*Account, error) Add(ctx context.Context, account *Account) error Update(ctx context.Context, account *Account) error Delete(ctx context.Context, id int) error ListAccount(ctx context.Context) []*app.Account OneAccount(ctx context.Context, id int) (*app.Account, error) ListAccountLink(ctx context.Context) []*app.AccountLink OneAccountLink(ctx context.Context, id int) (*app.AccountLink, error) ListAccountTiny(ctx context.Context) []*app.AccountTiny OneAccountTiny(ctx context.Context, id int) (*app.AccountTiny, error) }
AccountStorage represents the storage interface.
type Bottle ¶
type Bottle struct { ID int `gorm:"primary_key"` // primary key AccountID int // Belongs To Account Color string Country *string CreatedAt time.Time DeletedAt *time.Time Name string Rating int Region *string Review *string Sweetness *int UpdatedAt time.Time Varietal string Vineyard string Vintage int Account Account }
Bottle Model
func BottleFromBottlePayload ¶
func BottleFromBottlePayload(payload *app.BottlePayload) *Bottle
BottleFromBottlePayload Converts source BottlePayload to target Bottle model only copying the non-nil fields from the source.
func BottleFromCreateBottlePayload ¶
func BottleFromCreateBottlePayload(payload *app.CreateBottlePayload) *Bottle
BottleFromCreateBottlePayload Converts source CreateBottlePayload to target Bottle model only copying the non-nil fields from the source.
func (*Bottle) BottleToBottle ¶
BottleToBottle loads a Bottle and builds the default view of media type Bottle.
func (*Bottle) BottleToBottleFull ¶
func (m *Bottle) BottleToBottleFull() *app.BottleFull
BottleToBottleFull loads a Bottle and builds the full view of media type Bottle.
func (*Bottle) BottleToBottleTiny ¶
func (m *Bottle) BottleToBottleTiny() *app.BottleTiny
BottleToBottleTiny loads a Bottle and builds the tiny view of media type Bottle.
type BottleDB ¶
BottleDB is the implementation of the storage interface for Bottle.
func (*BottleDB) Get ¶
Get returns a single Bottle as a Database Model This is more for use internally, and probably not what you want in your controllers
func (*BottleDB) ListBottle ¶
ListBottle returns an array of view: default.
func (*BottleDB) ListBottleByYears ¶
func (m *BottleDB) ListBottleByYears(ctx context.Context, accountID int, years []int) (bottles []*app.Bottle, err error)
ListBottleByYears returns an array of view: default.
func (*BottleDB) ListBottleFull ¶
ListBottleFull returns an array of view: full.
func (*BottleDB) ListBottleTiny ¶
ListBottleTiny returns an array of view: tiny.
func (*BottleDB) OneBottle ¶
OneBottle loads a Bottle and builds the default view of media type Bottle.
func (*BottleDB) OneBottleFull ¶
func (m *BottleDB) OneBottleFull(ctx context.Context, id int, accountID int) (*app.BottleFull, error)
OneBottleFull loads a Bottle and builds the full view of media type Bottle.
func (*BottleDB) OneBottleTiny ¶
func (m *BottleDB) OneBottleTiny(ctx context.Context, id int, accountID int) (*app.BottleTiny, error)
OneBottleTiny loads a Bottle and builds the tiny view of media type Bottle.
func (*BottleDB) TableName ¶
TableName overrides the table name settings in Gorm to force a specific table name in the database.
func (*BottleDB) UpdateFromBottlePayload ¶
func (m *BottleDB) UpdateFromBottlePayload(ctx context.Context, payload *app.BottlePayload, id int) error
UpdateFromBottlePayload applies non-nil changes from BottlePayload to the model and saves it
func (*BottleDB) UpdateFromCreateBottlePayload ¶
func (m *BottleDB) UpdateFromCreateBottlePayload(ctx context.Context, payload *app.CreateBottlePayload, id int) error
UpdateFromCreateBottlePayload applies non-nil changes from CreateBottlePayload to the model and saves it
type BottleStorage ¶
type BottleStorage interface { DB() interface{} List(ctx context.Context) ([]*Bottle, error) Get(ctx context.Context, id int) (*Bottle, error) Add(ctx context.Context, bottle *Bottle) error Update(ctx context.Context, bottle *Bottle) error Delete(ctx context.Context, id int) error ListBottle(ctx context.Context, accountID int) []*app.Bottle OneBottle(ctx context.Context, id int, accountID int) (*app.Bottle, error) ListBottleFull(ctx context.Context, accountID int) []*app.BottleFull OneBottleFull(ctx context.Context, id int, accountID int) (*app.BottleFull, error) ListBottleTiny(ctx context.Context, accountID int) []*app.BottleTiny OneBottleTiny(ctx context.Context, id int, accountID int) (*app.BottleTiny, error) BottleFromCreateBottlePayload(payload *app.CreateBottlePayload) *Bottle UpdateFromBottlePayload(ctx context.Context, payload *app.BottlePayload, id int) error UpdateFromCreateBottlePayload(ctx context.Context, payload *app.CreateBottlePayload, id int) error }
BottleStorage represents the storage interface.