Documentation
¶
Index ¶
- Constants
- type AccountSvc
- type BaseAmountService
- type BaseAmountSvc
- type BulkRequest
- type CalculateDailyStatRequest
- type CategoryAssignment
- type CurrencyConverterSvc
- type DoubleEntrySvc
- type FillResponse
- type HistorySvc
- type LockerSvc
- type MapperSvc
- type RuleSvc
- type Service
- func (s *Service) BulkSetCategory(ctx context.Context, assignments []CategoryAssignment) error
- func (s *Service) BulkSetTags(ctx context.Context, assignments []TagsAssignment) error
- func (s *Service) ConvertRequestToTransaction(ctx context.Context, req *transactionsv1.CreateTransactionRequest, ...) (*database.Transaction, error)
- func (s *Service) Create(ctx context.Context, req *transactionsv1.CreateTransactionRequest) (*transactionsv1.CreateTransactionResponse, error)
- func (s *Service) CreateBulk(ctx context.Context, req []*transactionsv1.CreateTransactionRequest) ([]*transactionsv1.CreateTransactionResponse, error)
- func (s *Service) CreateBulkInternal(ctx context.Context, reqs []*BulkRequest, tx *gorm.DB, opts UpsertOptions) ([]*transactionsv1.CreateTransactionResponse, error)
- func (s *Service) CreateRawTransaction(ctx context.Context, newTx *database.Transaction) (*transactionsv1.CreateTransactionResponse, error)
- func (s *Service) DeleteTransaction(ctx context.Context, req *transactionsv1.DeleteTransactionsRequest) (*transactionsv1.DeleteTransactionsResponse, error)
- func (s *Service) FillDeposit(_ context.Context, req *transactionsv1.Income, newTx *database.Transaction) (*FillResponse, error)
- func (s *Service) FillWithdrawal(_ context.Context, req *transactionsv1.Expense, newTx *database.Transaction) (*FillResponse, error)
- func (s *Service) FinalizeTransactions(ctx context.Context, tx *gorm.DB, created []*database.Transaction, ...) ([]*transactionsv1.CreateTransactionResponse, error)
- func (s *Service) GetTitleSuggestions(ctx context.Context, req *transactionsv1.GetTitleSuggestionsRequest) (*transactionsv1.GetTitleSuggestionsResponse, error)
- func (s *Service) GetTransactionByIDs(ctx context.Context, ids []int64) ([]*database.Transaction, error)
- func (s *Service) List(ctx context.Context, req *transactionsv1.ListTransactionsRequest) (*transactionsv1.ListTransactionsResponse, error)
- func (s *Service) StoreStat(ctx context.Context, tx *gorm.DB, created []*database.Transaction, ...) error
- func (s *Service) Update(ctx context.Context, req *transactionsv1.UpdateTransactionRequest) (*transactionsv1.UpdateTransactionResponse, error)
- type ServiceConfig
- type StatService
- func (s *StatService) BuildImpactedAccounts(newTxs []*database.Transaction) map[int32]time.Time
- func (s *StatService) CalculateDailyStat(_ context.Context, dbTx *gorm.DB, req CalculateDailyStatRequest) error
- func (s *StatService) HandleTransactions(ctx context.Context, dbTx *gorm.DB, newTxs []*database.Transaction) error
- type StatsSvc
- type TagsAssignment
- type UpsertOptions
- type ValidationSvc
Constants ¶
View Source
const (
DefaultSuggestionLimit = 50
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountSvc ¶ added in v0.2.0
type BaseAmountService ¶
type BaseAmountService struct {
// contains filtered or unexported fields
}
func NewBaseAmountService ¶
func NewBaseAmountService( baseCurrency string, ) *BaseAmountService
func (*BaseAmountService) RecalculateAmountInBaseCurrency ¶
func (s *BaseAmountService) RecalculateAmountInBaseCurrency( _ context.Context, tx *gorm.DB, specificTxIDs []*database.Transaction, ) error
func (*BaseAmountService) RecalculateAmountInBaseCurrencyForAll ¶
type BaseAmountSvc ¶
type BulkRequest ¶
type BulkRequest struct {
OriginalTx *database.Transaction // for update
Req *transactionsv1.CreateTransactionRequest
}
type CategoryAssignment ¶ added in v0.3.1
type CurrencyConverterSvc ¶
type DoubleEntrySvc ¶ added in v0.2.0
type FillResponse ¶ added in v0.2.0
type HistorySvc ¶ added in v1.2.0
type MapperSvc ¶
type MapperSvc interface {
MapTransaction(ctx context.Context, tx *database.Transaction) *v1.Transaction
}
type RuleSvc ¶
type RuleSvc interface {
ProcessTransactions(
ctx context.Context,
inputTxs []*database.Transaction,
) ([]*database.Transaction, error)
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService( cfg *ServiceConfig, ) *Service
func (*Service) BulkSetCategory ¶ added in v0.3.1
func (s *Service) BulkSetCategory( ctx context.Context, assignments []CategoryAssignment, ) error
func (*Service) BulkSetTags ¶ added in v0.3.1
func (s *Service) BulkSetTags( ctx context.Context, assignments []TagsAssignment, ) error
func (*Service) ConvertRequestToTransaction ¶ added in v0.2.9
func (s *Service) ConvertRequestToTransaction( ctx context.Context, req *transactionsv1.CreateTransactionRequest, originalTx *database.Transaction, ) (*database.Transaction, error)
ConvertRequestToTransaction converts a CreateTransactionRequest to a database.Transaction
func (*Service) Create ¶
func (s *Service) Create( ctx context.Context, req *transactionsv1.CreateTransactionRequest, ) (*transactionsv1.CreateTransactionResponse, error)
func (*Service) CreateBulk ¶
func (s *Service) CreateBulk( ctx context.Context, req []*transactionsv1.CreateTransactionRequest, ) ([]*transactionsv1.CreateTransactionResponse, error)
func (*Service) CreateBulkInternal ¶
func (s *Service) CreateBulkInternal( ctx context.Context, reqs []*BulkRequest, tx *gorm.DB, opts UpsertOptions, ) ([]*transactionsv1.CreateTransactionResponse, error)
func (*Service) CreateRawTransaction ¶ added in v0.1.1
func (s *Service) CreateRawTransaction( ctx context.Context, newTx *database.Transaction, ) (*transactionsv1.CreateTransactionResponse, error)
func (*Service) DeleteTransaction ¶ added in v0.2.9
func (s *Service) DeleteTransaction( ctx context.Context, req *transactionsv1.DeleteTransactionsRequest, ) (*transactionsv1.DeleteTransactionsResponse, error)
func (*Service) FillDeposit ¶ added in v0.2.0
func (s *Service) FillDeposit( _ context.Context, req *transactionsv1.Income, newTx *database.Transaction, ) (*FillResponse, error)
func (*Service) FillWithdrawal ¶ added in v0.2.0
func (s *Service) FillWithdrawal( _ context.Context, req *transactionsv1.Expense, newTx *database.Transaction, ) (*FillResponse, error)
func (*Service) FinalizeTransactions ¶ added in v0.1.1
func (s *Service) FinalizeTransactions( ctx context.Context, tx *gorm.DB, created []*database.Transaction, originalTxs []*database.Transaction, opts UpsertOptions, ) ([]*transactionsv1.CreateTransactionResponse, error)
func (*Service) GetTitleSuggestions ¶ added in v0.2.7
func (s *Service) GetTitleSuggestions( ctx context.Context, req *transactionsv1.GetTitleSuggestionsRequest, ) (*transactionsv1.GetTitleSuggestionsResponse, error)
func (*Service) GetTransactionByIDs ¶
func (*Service) List ¶
func (s *Service) List( ctx context.Context, req *transactionsv1.ListTransactionsRequest, ) (*transactionsv1.ListTransactionsResponse, error)
func (*Service) Update ¶
func (s *Service) Update( ctx context.Context, req *transactionsv1.UpdateTransactionRequest, ) (*transactionsv1.UpdateTransactionResponse, error)
type ServiceConfig ¶
type ServiceConfig struct {
StatsSvc StatsSvc
MapperSvc MapperSvc
CurrencyConverterSvc CurrencyConverterSvc
BaseAmountService BaseAmountSvc
RuleSvc RuleSvc
ValidationSvc ValidationSvc
DoubleEntry DoubleEntrySvc
AccountSvc AccountSvc
HistorySvc HistorySvc
}
type StatService ¶
type StatService struct {
// contains filtered or unexported fields
}
func NewStatService ¶
func NewStatService() *StatService
func (*StatService) BuildImpactedAccounts ¶
func (s *StatService) BuildImpactedAccounts(newTxs []*database.Transaction) map[int32]time.Time
func (*StatService) CalculateDailyStat ¶
func (s *StatService) CalculateDailyStat( _ context.Context, dbTx *gorm.DB, req CalculateDailyStatRequest, ) error
func (*StatService) HandleTransactions ¶
func (s *StatService) HandleTransactions( ctx context.Context, dbTx *gorm.DB, newTxs []*database.Transaction, ) error
type TagsAssignment ¶ added in v0.3.1
type UpsertOptions ¶ added in v0.2.0
type ValidationSvc ¶ added in v0.2.0
Click to show internal directories.
Click to hide internal directories.