Documentation ¶
Index ¶
- type Category
- type CategoryDao
- func (cd *CategoryDao) CreateMapping(parent, child Category) (Mapping, error)
- func (cd *CategoryDao) Exist(account accountModel.Account) (bool, error)
- func (cd *CategoryDao) GetAll(account accountModel.Account, incomeExpense *constant.IncomeExpense) ([]Category, error)
- func (cd *CategoryDao) GetFatherList(account accountModel.Account, incomeExpense *constant.IncomeExpense) ([]Father, error)
- func (cd *CategoryDao) GetListByAccount(account accountModel.Account, ie *constant.IncomeExpense) (list []Category, err error)
- func (cd *CategoryDao) GetListByFather(father Father) ([]Category, error)
- func (cd *CategoryDao) GetMappingByAccountMappingOrderByParentCategory(parentAccountId, childAccountId uint) ([]Mapping, error)
- func (cd *CategoryDao) GetUnmappedList(mainAccount, mappingAccount accountModel.Account, ie *constant.IncomeExpense) (list []Category, err error)
- func (cd *CategoryDao) Order(list []Category)
- func (cd *CategoryDao) OrderFather(list []Father)
- func (cd *CategoryDao) SelectById(id uint) (category Category, err error)
- func (cd *CategoryDao) SelectByName(accountId uint, name string) (category Category, err error)
- func (cd *CategoryDao) SelectFatherById(id uint) (father Father, err error)
- func (cd *CategoryDao) SelectFatherFirstChild(fatherId uint) (Father, error)
- func (cd *CategoryDao) SelectFirstChild(categoryId uint) (Category, error)
- func (cd *CategoryDao) SelectMapping(parentAccountId, childCategoryId uint) (Mapping, error)
- func (cd *CategoryDao) SelectMappingByCAccountIdAndPCategoryId(childAccountId, parentCategoryId uint) (Mapping, error)
- func (cd *CategoryDao) Update(categoryId uint, data CategoryUpdateData) error
- func (cd *CategoryDao) UpdateChildPrevious(categoryId, newPrevious uint) error
- func (cd *CategoryDao) UpdateFatherChildPrevious(categoryId, newPrevious uint) error
- type CategoryUpdateData
- type Condition
- type Father
- type Mapping
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Category ¶
type Category struct { ID uint `gorm:"comment:'主键';primary_key;" ` AccountId uint `gorm:"comment:'账本ID';uniqueIndex:unique_name,priority:1"` FatherId uint `gorm:"comment:'category_father表ID';index" ` IncomeExpense constant.IncomeExpense `gorm:"comment:'收支类型'"` Name string `gorm:"comment:'名称';size:128;uniqueIndex:unique_name,priority:2"` Icon string `gorm:"comment:'图标';size:64"` Previous uint `gorm:"comment:'前一位'"` OrderUpdatedAt time.Time `gorm:"comment:'顺序更新时间';not null;default:now();type:TIMESTAMP;"` CreatedAt time.Time `gorm:"type:TIMESTAMP"` UpdatedAt time.Time `gorm:"type:TIMESTAMP"` DeletedAt gorm.DeletedAt `gorm:"index;type:TIMESTAMP"` commonModel.BaseModel }
func (*Category) GetAccount ¶
func (c *Category) GetAccount() (result accountModel.Account, err error)
func (*Category) SelectById ¶
type CategoryDao ¶
type CategoryDao struct {
// contains filtered or unexported fields
}
func NewDao ¶
func NewDao(db ...*gorm.DB) *CategoryDao
func (*CategoryDao) CreateMapping ¶
func (cd *CategoryDao) CreateMapping(parent, child Category) (Mapping, error)
func (*CategoryDao) Exist ¶
func (cd *CategoryDao) Exist(account accountModel.Account) (bool, error)
func (*CategoryDao) GetAll ¶
func (cd *CategoryDao) GetAll(account accountModel.Account, incomeExpense *constant.IncomeExpense) ([]Category, error)
func (*CategoryDao) GetFatherList ¶
func (cd *CategoryDao) GetFatherList(account accountModel.Account, incomeExpense *constant.IncomeExpense) ( []Father, error)
func (*CategoryDao) GetListByAccount ¶
func (cd *CategoryDao) GetListByAccount(account accountModel.Account, ie *constant.IncomeExpense) ( list []Category, err error)
func (*CategoryDao) GetListByFather ¶
func (cd *CategoryDao) GetListByFather(father Father) ([]Category, error)
func (*CategoryDao) GetMappingByAccountMappingOrderByParentCategory ¶
func (cd *CategoryDao) GetMappingByAccountMappingOrderByParentCategory(parentAccountId, childAccountId uint) ( []Mapping, error, )
func (*CategoryDao) GetUnmappedList ¶
func (cd *CategoryDao) GetUnmappedList( mainAccount, mappingAccount accountModel.Account, ie *constant.IncomeExpense) (list []Category, err error)
func (*CategoryDao) Order ¶
func (cd *CategoryDao) Order(list []Category)
func (*CategoryDao) OrderFather ¶
func (cd *CategoryDao) OrderFather(list []Father)
func (*CategoryDao) SelectById ¶
func (cd *CategoryDao) SelectById(id uint) (category Category, err error)
func (*CategoryDao) SelectByName ¶
func (cd *CategoryDao) SelectByName(accountId uint, name string) (category Category, err error)
func (*CategoryDao) SelectFatherById ¶
func (cd *CategoryDao) SelectFatherById(id uint) (father Father, err error)
func (*CategoryDao) SelectFatherFirstChild ¶
func (cd *CategoryDao) SelectFatherFirstChild(fatherId uint) (Father, error)
func (*CategoryDao) SelectFirstChild ¶
func (cd *CategoryDao) SelectFirstChild(categoryId uint) (Category, error)
func (*CategoryDao) SelectMapping ¶
func (cd *CategoryDao) SelectMapping(parentAccountId, childCategoryId uint) (Mapping, error)
func (*CategoryDao) SelectMappingByCAccountIdAndPCategoryId ¶
func (cd *CategoryDao) SelectMappingByCAccountIdAndPCategoryId(childAccountId, parentCategoryId uint) (Mapping, error)
SelectMappingByCAccountIdAndPCategoryId 通过子账本这父交易类型查询关联交易类型
func (*CategoryDao) Update ¶
func (cd *CategoryDao) Update(categoryId uint, data CategoryUpdateData) error
func (*CategoryDao) UpdateChildPrevious ¶
func (cd *CategoryDao) UpdateChildPrevious(categoryId, newPrevious uint) error
func (*CategoryDao) UpdateFatherChildPrevious ¶
func (cd *CategoryDao) UpdateFatherChildPrevious(categoryId, newPrevious uint) error
type CategoryUpdateData ¶
type Father ¶
type Father struct { ID uint `gorm:"primary_key"` AccountId uint `gorm:"index;comment:'账本ID'"` IncomeExpense constant.IncomeExpense `gorm:"comment:'收支类型'"` Name string `gorm:"size:128;comment:'名称'"` Previous uint `gorm:"comment:'前一位'"` OrderUpdatedAt time.Time `gorm:"type:TIMESTAMP"` CreatedAt time.Time `gorm:"type:TIMESTAMP"` commonModel.BaseModel }
func (*Father) SelectById ¶
type Mapping ¶
type Mapping struct { ID uint `gorm:"primarykey"` ParentAccountId uint `gorm:"comment:'父账本ID';uniqueIndex:idx_mapping,priority:2"` ChildAccountId uint `gorm:"comment:'子账本ID';" ` ParentCategoryId uint `gorm:"comment:'父收支类型ID';index"` ChildCategoryId uint `gorm:"comment:'子收支类型ID';uniqueIndex:idx_mapping,priority:1"` CreatedAt time.Time `gorm:"type:TIMESTAMP"` UpdatedAt time.Time `gorm:"type:TIMESTAMP"` DeletedAt gorm.DeletedAt `gorm:"index;type:TIMESTAMP"` commonModel.BaseModel }
Mapping ParentAccountId - ChildCategoryId unique ParentCategoryId - ChildCategoryId unique ChildAccountId - ParentCategoryId unique
Click to show internal directories.
Click to hide internal directories.