Documentation ¶
Index ¶
- func BottleCategoryFilterByBottle(bottleID int, originaldb *gorm.DB) func(db *gorm.DB) *gorm.DB
- func BottleCategoryFilterByCategory(categoryID int, originaldb *gorm.DB) func(db *gorm.DB) *gorm.DB
- 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) OneAccount(ctx context.Context, id int) (*app.Account, error)
- func (m *AccountDB) TableName() string
- func (m *AccountDB) Update(ctx context.Context, model *Account) error
- type AccountStorage
- type Bottle
- type BottleCategory
- type BottleCategoryDB
- func (m *BottleCategoryDB) Add(ctx context.Context, model *BottleCategory) error
- func (m *BottleCategoryDB) DB() interface{}
- func (m *BottleCategoryDB) Delete(ctx context.Context, id int) error
- func (m *BottleCategoryDB) Get(ctx context.Context, id int) (*BottleCategory, error)
- func (m *BottleCategoryDB) List(ctx context.Context) ([]*BottleCategory, error)
- func (m *BottleCategoryDB) TableName() string
- func (m *BottleCategoryDB) Update(ctx context.Context, model *BottleCategory) error
- type BottleCategoryStorage
- 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) ListBottleFullScan(ctx context.Context, accountID int) []*app.BottleRelation
- func (m *BottleDB) ListBottleRelation(ctx context.Context, accountID int) []*app.BottleRelation
- func (m *BottleDB) OneBottle(ctx context.Context, id int, accountID int) (*app.Bottle, error)
- func (m *BottleDB) OneBottleRelation(ctx context.Context, id int, accountID int) (*app.BottleRelation, error)
- func (m *BottleDB) TableName() string
- func (m *BottleDB) Update(ctx context.Context, model *Bottle) error
- type BottleStorage
- type Category
- type CategoryDB
- func (m *CategoryDB) Add(ctx context.Context, model *Category) error
- func (m *CategoryDB) DB() interface{}
- func (m *CategoryDB) Delete(ctx context.Context, id int) error
- func (m *CategoryDB) Get(ctx context.Context, id int) (*Category, error)
- func (m *CategoryDB) List(ctx context.Context) ([]*Category, error)
- func (m *CategoryDB) ListCategory(ctx context.Context) []*app.Category
- func (m *CategoryDB) OneCategory(ctx context.Context, id int) (*app.Category, error)
- func (m *CategoryDB) TableName() string
- func (m *CategoryDB) Update(ctx context.Context, model *Category) error
- type CategoryStorage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BottleCategoryFilterByBottle ¶
BottleCategoryFilterByBottle is a gorm filter for a Belongs To relationship.
func BottleCategoryFilterByCategory ¶
BottleCategoryFilterByCategory is a gorm filter for a Belongs To relationship.
Types ¶
type Account ¶
type Account struct { ID int `gorm:"primary_key"` // primary key Bottles []Bottle // has many Bottles Email string Name string CreatedAt time.Time // timestamp DeletedAt *time.Time // nullable timestamp (soft delete) UpdatedAt time.Time // timestamp }
celler account
func (*Account) AccountToAccount ¶
AccountToAccount loads a Account and builds the default 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) OneAccount ¶
OneAccount loads a Account and builds the default 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) }
AccountStorage represents the storage interface.
type Bottle ¶
type Bottle struct { ID int `gorm:"primary_key"` // primary key AccountID int // Belongs To Account BottleCategories []BottleCategory // has many BottleCategories Categories []Category `gorm:"many2many:bottle_categories"` // many to many Bottle/Category Name string Quantity int CreatedAt time.Time // timestamp DeletedAt *time.Time // nullable timestamp (soft delete) UpdatedAt time.Time // timestamp Account Account }
celler bottle
func (*Bottle) BottleToBottle ¶
BottleToBottle loads a Bottle and builds the default view of media type Bottle.
func (*Bottle) BottleToBottleRelation ¶
func (m *Bottle) BottleToBottleRelation() *app.BottleRelation
BottleToBottleRelation loads a Bottle and builds the relation view of media type Bottle.
type BottleCategory ¶
type BottleCategory struct { ID int `gorm:"primary_key"` // primary key BottleID int // Belongs To Bottle CategoryID int // has many BottleCategory CreatedAt time.Time // timestamp DeletedAt *time.Time // nullable timestamp (soft delete) UpdatedAt time.Time // timestamp Bottle Bottle Category Category }
celler bottle category
func (BottleCategory) TableName ¶
func (m BottleCategory) TableName() string
TableName overrides the table name settings in Gorm to force a specific table name in the database.
type BottleCategoryDB ¶
BottleCategoryDB is the implementation of the storage interface for BottleCategory.
func NewBottleCategoryDB ¶
func NewBottleCategoryDB(db *gorm.DB) *BottleCategoryDB
NewBottleCategoryDB creates a new storage type.
func (*BottleCategoryDB) Add ¶
func (m *BottleCategoryDB) Add(ctx context.Context, model *BottleCategory) error
Add creates a new record.
func (*BottleCategoryDB) DB ¶
func (m *BottleCategoryDB) DB() interface{}
DB returns the underlying database.
func (*BottleCategoryDB) Delete ¶
func (m *BottleCategoryDB) Delete(ctx context.Context, id int) error
Delete removes a single record.
func (*BottleCategoryDB) Get ¶
func (m *BottleCategoryDB) Get(ctx context.Context, id int) (*BottleCategory, error)
Get returns a single BottleCategory as a Database Model This is more for use internally, and probably not what you want in your controllers
func (*BottleCategoryDB) List ¶
func (m *BottleCategoryDB) List(ctx context.Context) ([]*BottleCategory, error)
List returns an array of BottleCategory
func (*BottleCategoryDB) TableName ¶
func (m *BottleCategoryDB) TableName() string
TableName overrides the table name settings in Gorm to force a specific table name in the database.
func (*BottleCategoryDB) Update ¶
func (m *BottleCategoryDB) Update(ctx context.Context, model *BottleCategory) error
Update modifies a single record.
type BottleCategoryStorage ¶
type BottleCategoryStorage interface { DB() interface{} List(ctx context.Context) ([]*BottleCategory, error) Get(ctx context.Context, id int) (*BottleCategory, error) Add(ctx context.Context, bottlecategory *BottleCategory) error Update(ctx context.Context, bottlecategory *BottleCategory) error Delete(ctx context.Context, id int) error }
BottleCategoryStorage represents the storage interface.
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) ListBottleFullScan ¶
ListBottle returns an array of view: default.
func (*BottleDB) ListBottleRelation ¶
ListBottleRelation returns an array of view: relation.
func (*BottleDB) OneBottle ¶
OneBottle loads a Bottle and builds the default view of media type Bottle.
func (*BottleDB) OneBottleRelation ¶
func (m *BottleDB) OneBottleRelation(ctx context.Context, id int, accountID int) (*app.BottleRelation, error)
OneBottleRelation loads a Bottle and builds the relation view of media type Bottle.
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) ListBottleRelation(ctx context.Context, accountID int) []*app.BottleRelation OneBottleRelation(ctx context.Context, id int, accountID int) (*app.BottleRelation, error) }
BottleStorage represents the storage interface.
type Category ¶
type Category struct { ID int `gorm:"primary_key"` // primary key BottleCategories []BottleCategory // has many BottleCategories Bottles []Bottle `gorm:"many2many:Bottles"` // many to many Category/Bottle Name string CreatedAt time.Time // timestamp DeletedAt *time.Time // nullable timestamp (soft delete) UpdatedAt time.Time // timestamp }
celler category
func (*Category) CategoryToCategory ¶
CategoryToCategory loads a Category and builds the default view of media type Category.
type CategoryDB ¶
CategoryDB is the implementation of the storage interface for Category.
func NewCategoryDB ¶
func NewCategoryDB(db *gorm.DB) *CategoryDB
NewCategoryDB creates a new storage type.
func (*CategoryDB) Add ¶
func (m *CategoryDB) Add(ctx context.Context, model *Category) error
Add creates a new record.
func (*CategoryDB) Delete ¶
func (m *CategoryDB) Delete(ctx context.Context, id int) error
Delete removes a single record.
func (*CategoryDB) Get ¶
Get returns a single Category as a Database Model This is more for use internally, and probably not what you want in your controllers
func (*CategoryDB) List ¶
func (m *CategoryDB) List(ctx context.Context) ([]*Category, error)
List returns an array of Category
func (*CategoryDB) ListCategory ¶
func (m *CategoryDB) ListCategory(ctx context.Context) []*app.Category
ListCategory returns an array of view: default.
func (*CategoryDB) OneCategory ¶
OneCategory loads a Category and builds the default view of media type Category.
func (*CategoryDB) TableName ¶
func (m *CategoryDB) TableName() string
TableName overrides the table name settings in Gorm to force a specific table name in the database.
type CategoryStorage ¶
type CategoryStorage interface { DB() interface{} List(ctx context.Context) ([]*Category, error) Get(ctx context.Context, id int) (*Category, error) Add(ctx context.Context, category *Category) error Update(ctx context.Context, category *Category) error Delete(ctx context.Context, id int) error ListCategory(ctx context.Context) []*app.Category OneCategory(ctx context.Context, id int) (*app.Category, error) }
CategoryStorage represents the storage interface.