Documentation
¶
Index ¶
- type BankSyncJob
- type BankSyncWorker
- type BankSyncWorkerDeps
- type EmailJob
- type EmailWorker
- type ExchangeRatesSyncJob
- type ExchangeRatesSyncWorker
- type ExchangeRatesWorkerDeps
- type ExportJob
- type ExportWorker
- type HistoricalExchangeRateJob
- type HistoricalExchangeRateWorker
- type Service
- func (s *Service) EnqueueBankSync(ctx context.Context, userID, connectionID uuid.UUID, syncType string) error
- func (s *Service) EnqueueEmail(ctx context.Context, userID int64, email, template string, ...) error
- func (s *Service) EnqueueExchangeRatesSync(ctx context.Context, jobDate time.Time) error
- func (s *Service) EnqueueExport(ctx context.Context, userID int64, exportType string, from, to time.Time) error
- func (s *Service) EnqueueHistoricalExchangeRateUpdate(ctx context.Context, baseCurrency string, startDate, endDate time.Time) error
- func (s *Service) Start(ctx context.Context) error
- func (s *Service) Stop(ctx context.Context) error
- func (s *Service) UpdateAllExchangeRates(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BankSyncJob ¶
type BankSyncJob struct {
UserID uuid.UUID `json:"user_id"`
ConnectionID uuid.UUID `json:"connection_id"`
SyncType string `json:"sync_type"` // "full" or "incremental"
}
func (BankSyncJob) Kind ¶
func (BankSyncJob) Kind() string
type BankSyncWorker ¶
type BankSyncWorker struct {
river.WorkerDefaults[BankSyncJob]
// contains filtered or unexported fields
}
func (*BankSyncWorker) Work ¶
func (w *BankSyncWorker) Work(ctx context.Context, job *river.Job[BankSyncJob]) error
After adding an account, start a sync job that sync accounts & transactions for that connection then schedule a sync every day
type BankSyncWorkerDeps ¶
type BankSyncWorkerDeps struct {
DB *pgxpool.Pool
Queries *repository.Queries
FinanceManager *finance.ProviderManager
Logger *zerolog.Logger
}
type EmailJob ¶
type EmailWorker ¶
type EmailWorker struct {
river.WorkerDefaults[EmailJob]
// contains filtered or unexported fields
}
type ExchangeRatesSyncJob ¶
func (ExchangeRatesSyncJob) Kind ¶
func (ExchangeRatesSyncJob) Kind() string
type ExchangeRatesSyncWorker ¶
type ExchangeRatesSyncWorker struct {
river.WorkerDefaults[ExchangeRatesSyncJob]
// contains filtered or unexported fields
}
func (*ExchangeRatesSyncWorker) NextRetry ¶
func (w *ExchangeRatesSyncWorker) NextRetry(job *river.Job[ExchangeRatesSyncJob]) time.Time
NextRetry determines when to retry a failed job (1h here)
func (*ExchangeRatesSyncWorker) Timeout ¶
func (w *ExchangeRatesSyncWorker) Timeout(job *river.Job[ExchangeRatesSyncJob]) time.Duration
Timeout returns how long the job can run before timing out (10 min here)
func (*ExchangeRatesSyncWorker) Work ¶
func (w *ExchangeRatesSyncWorker) Work(ctx context.Context, job *river.Job[ExchangeRatesSyncJob]) error
type ExchangeRatesWorkerDeps ¶
type ExportJob ¶
type ExportWorker ¶
type ExportWorker struct {
river.WorkerDefaults[ExportJob]
// contains filtered or unexported fields
}
type HistoricalExchangeRateJob ¶
type HistoricalExchangeRateJob struct {
BaseCurrency string `json:"base_currency"`
StartDate time.Time `json:"start_date"`
EndDate time.Time `json:"end_date"`
}
Historical Exchange Rate Job for backfilling data
func (HistoricalExchangeRateJob) Kind ¶
func (HistoricalExchangeRateJob) Kind() string
type HistoricalExchangeRateWorker ¶
type HistoricalExchangeRateWorker struct {
river.WorkerDefaults[HistoricalExchangeRateJob]
// contains filtered or unexported fields
}
func (*HistoricalExchangeRateWorker) Work ¶
func (w *HistoricalExchangeRateWorker) Work(ctx context.Context, job *river.Job[HistoricalExchangeRateJob]) error
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Job Service
func NewService ¶
func (*Service) EnqueueBankSync ¶
func (*Service) EnqueueEmail ¶
func (s *Service) EnqueueEmail(ctx context.Context, userID int64, email, template string, variables map[string]any) error
Job enqueueing methods
func (*Service) EnqueueExchangeRatesSync ¶
Bulk exchange rate sync methods
func (*Service) EnqueueExport ¶
func (*Service) EnqueueHistoricalExchangeRateUpdate ¶
Click to show internal directories.
Click to hide internal directories.