Versions in this module Expand all Collapse all v1 v1.0.1 Nov 17, 2024 v1.0.0 Oct 29, 2024 Changes in this version + func ExpenseAccumulate(tradeTime time.Time, accountId uint, userId uint, categoryId uint, amount int, ...) error + func IncomeAccumulate(tradeTime time.Time, accountId uint, userId uint, categoryId uint, amount int, ...) error + type CategoryAmountRank struct + CategoryId uint + type CategoryAmountRankCondition struct + Account accountModel.Account + EndTime time.Time + StartTime time.Time + func (c *CategoryAmountRankCondition) Local() + type Condition struct + IncomeExpense *constant.IncomeExpense + type DayStatistic struct + Date time.Time + type ExpenseAccountStatistic struct + AccountId uint + func (e *ExpenseAccountStatistic) Accumulate(tradeTime time.Time, accountId uint, amount int, count int, tx *gorm.DB) error + func (i *ExpenseAccountStatistic) TableName() string + type ExpenseAccountUserStatistic struct + AccountId uint + CategoryId uint + UserId uint + func (e *ExpenseAccountUserStatistic) Accumulate(tradeTime time.Time, accountId uint, userId uint, categoryId uint, amount int, ...) error + func (i *ExpenseAccountUserStatistic) TableName() string + type ExpenseCategoryStatistic struct + AccountId uint + CategoryId uint + func (e *ExpenseCategoryStatistic) Accumulate(tradeTime time.Time, accountId uint, categoryId uint, amount int, count int, ...) error + func (e *ExpenseCategoryStatistic) TableName() string + type ExtensionCondition struct + MaxAmount *int + MinAmount *int + func (ec *ExtensionCondition) IsSet() bool + type ForeignKeyCondition struct + AccountId uint + CategoryIds *[]uint + UserIds *[]uint + func (f *ForeignKeyCondition) GetStatisticTableName(ie constant.IncomeExpense) string + type IncomeAccountStatistic struct + AccountId uint + func (i *IncomeAccountStatistic) Accumulate(tradeTime time.Time, accountId uint, amount int, count int, tx *gorm.DB) error + func (i *IncomeAccountStatistic) TableName() string + type IncomeAccountUserStatistic struct + AccountId uint + CategoryId uint + UserId uint + func (i *IncomeAccountUserStatistic) Accumulate(tradeTime time.Time, accountId uint, userId uint, categoryId uint, amount int, ...) error + func (i *IncomeAccountUserStatistic) TableName() string + type IncomeCategoryStatistic struct + AccountId uint + CategoryId uint + func (i *IncomeCategoryStatistic) Accumulate(tradeTime time.Time, accountId uint, categoryId uint, amount int, count int, ...) error + func (i *IncomeCategoryStatistic) TableName() string + type Info struct + AccountId uint + Amount int + CategoryId uint + IncomeExpense constant.IncomeExpense + Remark string + TradeTime time.Time + UserId uint + func (i *Info) Check(db *gorm.DB) error + func (t *Info) GetAccount(db ...*gorm.DB) (account accountModel.Account, err error) + func (t *Info) GetCategory(db ...*gorm.DB) (category categoryModel.Category, err error) + func (t *Info) GetStatisticData(isAdd bool) StatisticData + func (t *Info) GetUser(selects ...interface{}) (user userModel.User, err error) + type Mapping struct + ID uint + LastSyncedTransUpdateTime time.Time + MainAccountId uint + MainId uint + RelatedAccountId uint + RelatedId uint + func (m *Mapping) CanSyncTrans(transaction Transaction) bool + func (m *Mapping) ForShare(tx *gorm.DB) error + func (m *Mapping) OnSyncSuccess(db *gorm.DB, transaction Transaction) error + func (m *Mapping) TableName() string + type RecordType int8 + const RecordTypeOfImport + const RecordTypeOfManual + const RecordTypeOfSync + const RecordTypeOfTiming + type Statistic struct + Amount int + Count int + Date time.Time + func (s *Statistic) GetDate(t time.Time) time.Time + func (s *Statistic) GetUpdatesValue(amount, count int) map[string]interface{} + type StatisticCondition struct + EndTime time.Time + StartTime time.Time + func (s *StatisticCondition) CheckAvailability() bool + type StatisticConditionBuilder struct + func NewStatisticConditionBuilder(accountId uint) *StatisticConditionBuilder + func (b *StatisticConditionBuilder) Build() *StatisticCondition + func (b *StatisticConditionBuilder) WithCategoryIds(Ids []uint) *StatisticConditionBuilder + func (b *StatisticConditionBuilder) WithDate(startTime, endTime time.Time) *StatisticConditionBuilder + func (b *StatisticConditionBuilder) WithUserIds(Ids []uint) *StatisticConditionBuilder + type StatisticDao struct + func NewStatisticDao(db ...*gorm.DB) *StatisticDao + func (s *StatisticDao) GetAmountCountByCondition(condition StatisticCondition, ie constant.IncomeExpense) (result global.AmountCount, err error) + func (s *StatisticDao) GetCategoryAmountRank(ie constant.IncomeExpense, condition CategoryAmountRankCondition, limit *int) (result []CategoryAmountRank, err error) + func (s *StatisticDao) GetDayStatisticByCondition(ie constant.IncomeExpense, condition StatisticCondition) (result []DayStatistic, err error) + func (s *StatisticDao) GetIeStatisticByCondition(ie *constant.IncomeExpense, condition StatisticCondition) (result global.IEStatistic, err error) + func (s *StatisticDao) GetTotalByCondition(ie constant.IncomeExpense, condition StatisticCondition) (result global.AmountCount, err error) + type StatisticData struct + AccountId uint + Amount int + CategoryId uint + Count int + IncomeExpense constant.IncomeExpense + Location string + TradeTime time.Time + UserId uint + type TimeCondition struct + TradeEndTime *time.Time + TradeStartTime *time.Time + func NewTimeCondition() *TimeCondition + func (tc *TimeCondition) SetTradeTimes(startTime, endTime time.Time) + type Timing struct + AccountId uint + Close bool + ID uint + NextTime time.Time + OffsetDays int + TransInfo Info + Type TimingType + UserId uint + func (t *Timing) ForUpdate(tx *gorm.DB) error + func (t *Timing) MakeExecTask(db *gorm.DB) (TimingExec, error) + func (t *Timing) Open(tx *gorm.DB) error + func (t *Timing) TableName() string + func (t *Timing) UpdateNextTime(db *gorm.DB) error + type TimingExec struct + ConfigId uint + ExecTime sql.NullTime + FailCause string + ID uint + Status TimingExecStatus + TransInfo Info + TransactionId uint + func (t *TimingExec) ExecFail(execErr error, db *gorm.DB) error + func (t *TimingExec) ExecSuccess(trans Transaction, db *gorm.DB) error + func (t *TimingExec) GetConfig(db *gorm.DB) (Timing, error) + func (t *TimingExec) TableName() string + type TimingExecStatus int8 + const TimingExecFail + const TimingExecSuccess + const TimingExecWait + type TimingType string + const EveryDay + const EveryMonth + const EveryWeek + const LastDayOfMonth + const Once + type Transaction struct + CreatedAt time.Time + DeletedAt gorm.DeletedAt + ID uint + RecordType RecordType + UpdatedAt time.Time + func (t *Transaction) Exits(query interface{}, args ...interface{}) (bool, error) + func (t *Transaction) ForShare(tx *gorm.DB) error + func (t *Transaction) ForUpdate(tx *gorm.DB) error + func (t *Transaction) SelectById(id uint) error + func (t *Transaction) SyncDataClone() Transaction + type TransactionDao struct + func NewDao(db ...*gorm.DB) *TransactionDao + func (t *TransactionDao) Create(info Info, recordType RecordType) (result Transaction, err error) + func (t *TransactionDao) GetAmountRank(accountId uint, ie constant.IncomeExpense, timeCond TimeCondition) (result []Transaction, err error) + func (t *TransactionDao) GetIeStatisticByCondition(ie *constant.IncomeExpense, condition StatisticCondition, ...) (result global.IEStatistic, err error) + func (t *TransactionDao) GetListByCondition(condition Condition, offset int, limit int) (result []Transaction, err error) + func (t *TransactionDao) SelectAllTimingAndProcess(startTime time.Time, process func(timing Timing) error) (err error) + func (t *TransactionDao) SelectById(id uint, forUpdate bool) (result Transaction, err error) + func (t *TransactionDao) SelectMappingByTrans(trans, syncTrans Transaction) (mapping Mapping, err error) + func (t *TransactionDao) SelectTimingById(id uint) (result Timing, err error) + func (t *TransactionDao) SelectTimingListByUserId(accountId uint, offset int, limit int) (result []Timing, err error) + func (t *TransactionDao) SelectWaitTimingExec(startId uint, limit int) ([]TimingExec, error)