Documentation
¶
Overview ¶
Package sqlite provides SQLite query and persistence operations for Expensor.
Index ¶
- type Options
- type Store
- func (s *Store) AddLabel(ctx context.Context, tenant store.Tenant, transactionID, label string) error
- func (s *Store) AddLabels(ctx context.Context, tenant store.Tenant, transactionID string, ...) error
- func (s *Store) ApplyBucketByMerchant(ctx context.Context, tenant store.Tenant, bucket, merchant string) (int64, error)
- func (s *Store) ApplyCategoryByMerchant(ctx context.Context, tenant store.Tenant, category, merchant string) (int64, error)
- func (s *Store) ApplyLabelByMerchant(ctx context.Context, tenant store.Tenant, label, pattern string) (int64, error)
- func (s *Store) BootstrapRequired(ctx context.Context) (bool, error)
- func (s *Store) CategorizeMerchant(ctx context.Context, tenant store.Tenant, merchant, category, bucket string) (int64, error)
- func (s *Store) ClearActiveLLMProvider(ctx context.Context, tenant store.Tenant) error
- func (s *Store) ClearActiveScanningReader(ctx context.Context, tenant store.Tenant) error
- func (s *Store) Close()
- func (s *Store) CompleteAccountSetup(ctx context.Context, input store.CompleteAccountSetupInput) (*store.User, error)
- func (s *Store) CreateAccessToken(ctx context.Context, input store.CreateAccessTokenInput) (*store.AccessToken, error)
- func (s *Store) CreateAccountSetupToken(ctx context.Context, input store.CreateAccountSetupTokenInput) (*store.AccountSetupToken, error)
- func (s *Store) CreateBootstrapAdmin(ctx context.Context, input store.CreateBootstrapAdminInput) (*store.User, error)
- func (s *Store) CreateBucket(ctx context.Context, tenant store.Tenant, name, description string) error
- func (s *Store) CreateCategory(ctx context.Context, tenant store.Tenant, name, description string) error
- func (s *Store) CreateLabel(ctx context.Context, tenant store.Tenant, name, color string) error
- func (s *Store) CreateRule(ctx context.Context, tenant store.Tenant, rule store.RuleRow) (*store.RuleRow, error)
- func (s *Store) CreateSession(ctx context.Context, input store.CreateSessionInput) (*store.Session, error)
- func (s *Store) CreateUser(ctx context.Context, input store.CreateUserInput) (*store.User, error)
- func (s *Store) DeleteBucket(ctx context.Context, tenant store.Tenant, name string, ...) error
- func (s *Store) DeleteCategory(ctx context.Context, tenant store.Tenant, name string, ...) error
- func (s *Store) DeleteLLMProviderRuntime(ctx context.Context, tenant store.Tenant, provider string) error
- func (s *Store) DeleteLabel(ctx context.Context, tenant store.Tenant, name string, ...) error
- func (s *Store) DeleteMutedMerchant(ctx context.Context, tenant store.Tenant, id string) error
- func (s *Store) DeleteMutedMerchantAndUnmute(ctx context.Context, tenant store.Tenant, id string) error
- func (s *Store) DeleteReaderRuntime(ctx context.Context, tenant store.Tenant, reader string) error
- func (s *Store) DeleteReaderToken(ctx context.Context, tenant store.Tenant, reader string) error
- func (s *Store) DeleteRule(ctx context.Context, tenant store.Tenant, id string) error
- func (s *Store) DeleteUser(ctx context.Context, id string) error
- func (s *Store) EnsureScanningStateForTenant(ctx context.Context, tenant store.Tenant) error
- func (s *Store) FindAccessTokenByHash(ctx context.Context, tokenHash string) (*store.AccessToken, error)
- func (s *Store) FindAccountSetupTokenByHash(ctx context.Context, tokenHash string) (*store.AccountSetupToken, error)
- func (s *Store) FindSessionByHash(ctx context.Context, tokenHash string) (*store.Session, error)
- func (s *Store) FindUserByEmail(ctx context.Context, email string) (*store.User, error)
- func (s *Store) FindUserByID(ctx context.Context, id string) (*store.User, error)
- func (s *Store) GetActiveLLMProviderRuntime(ctx context.Context, tenant store.Tenant) (store.LLMProviderRuntime, bool, error)
- func (s *Store) GetAnnualSpend(ctx context.Context, tenant store.Tenant, year int) ([]store.DailyBucket, error)
- func (s *Store) GetAppConfig(ctx context.Context, tenant store.Tenant, key string) (string, error)
- func (s *Store) GetBucketMappings(ctx context.Context, tenant store.Tenant) (map[string][]string, error)
- func (s *Store) GetCategoryMappings(ctx context.Context, tenant store.Tenant) (map[string][]string, error)
- func (s *Store) GetChartData(ctx context.Context, tenant store.Tenant) (*store.ChartData, error)
- func (s *Store) GetCommunitySyncSettings(ctx context.Context) (store.CommunitySyncSettings, error)
- func (s *Store) GetCommunityURL(ctx context.Context) (string, error)
- func (s *Store) GetDashboardData(ctx context.Context, tenant store.Tenant) (*store.DashboardData, error)
- func (s *Store) GetExtractionDiagnostic(ctx context.Context, tenant store.Tenant, id string) (*store.ExtractionDiagnosticRow, error)
- func (s *Store) GetFacets(ctx context.Context, tenant store.Tenant) (*store.Facets, error)
- func (s *Store) GetLLMProviderConfig(ctx context.Context, tenant store.Tenant, provider string) (config json.RawMessage, found bool, err error)
- func (s *Store) GetLLMProviderCredentials(ctx context.Context, tenant store.Tenant, provider string) (credentials []byte, found bool, err error)
- func (s *Store) GetLabelMappings(ctx context.Context, tenant store.Tenant) (map[string][]string, error)
- func (s *Store) GetMonthlyBreakdownSpend(ctx context.Context, tenant store.Tenant, dimension string, months int) (*store.MonthlyBreakdownData, error)
- func (s *Store) GetMutedMerchantPatterns(ctx context.Context, tenant store.Tenant) ([]string, error)
- func (s *Store) GetMutedMerchantsWithCount(ctx context.Context, tenant store.Tenant) ([]store.MutedMerchantWithCount, error)
- func (s *Store) GetReaderConfig(ctx context.Context, tenant store.Tenant, reader string) (config json.RawMessage, found bool, err error)
- func (s *Store) GetReaderSecret(ctx context.Context, tenant store.Tenant, reader string) (value []byte, found bool, err error)
- func (s *Store) GetReaderToken(ctx context.Context, tenant store.Tenant, reader string) (value []byte, found bool, err error)
- func (s *Store) GetRule(ctx context.Context, tenant store.Tenant, id string) (*store.RuleRow, error)
- func (s *Store) GetScanningState(ctx context.Context, tenant store.Tenant) (store.TenantScanningState, error)
- func (s *Store) GetSchedulerConfig(ctx context.Context) (store.SchedulerConfig, error)
- func (s *Store) GetSpendingHeatmap(ctx context.Context, tenant store.Tenant, from, to *time.Time) (*store.HeatmapData, error)
- func (s *Store) GetStats(ctx context.Context, tenant store.Tenant, baseCurrency string) (*store.Stats, error)
- func (s *Store) GetSyncStatus(ctx context.Context) (store.SyncStatus, error)
- func (s *Store) GetTransaction(ctx context.Context, tenant store.Tenant, id string) (*store.Transaction, error)
- func (s *Store) HealthCheck(ctx context.Context) error
- func (s *Store) ImportUserRules(ctx context.Context, tenant store.Tenant, rules []store.RuleRow) error
- func (s *Store) IsMessageProcessed(ctx context.Context, tenant store.Tenant, key string) (bool, error)
- func (s *Store) ListAccessTokens(ctx context.Context, userID string) ([]store.AccessToken, error)
- func (s *Store) ListBuckets(ctx context.Context, tenant store.Tenant) ([]store.Bucket, error)
- func (s *Store) ListCategories(ctx context.Context, tenant store.Tenant) ([]store.Category, error)
- func (s *Store) ListExtractionDiagnostics(ctx context.Context, tenant store.Tenant, filter store.DiagnosticFilter) ([]store.ExtractionDiagnosticRow, error)
- func (s *Store) ListLabels(ctx context.Context, tenant store.Tenant) ([]store.Label, error)
- func (s *Store) ListMutedMerchants(ctx context.Context, tenant store.Tenant) ([]store.MutedMerchant, error)
- func (s *Store) ListRules(ctx context.Context, tenant store.Tenant) ([]store.RuleRow, error)
- func (s *Store) ListRunnableScanningStates(ctx context.Context) ([]store.TenantScanningState, error)
- func (s *Store) ListScanningStates(ctx context.Context) ([]store.TenantScanningState, error)
- func (s *Store) ListTransactions(ctx context.Context, tenant store.Tenant, filter store.ListFilter) ([]store.Transaction, store.TransactionListResult, error)
- func (s *Store) ListUsers(ctx context.Context) ([]store.User, error)
- func (s *Store) LoadCategorySnapshot(ctx context.Context) (api.CategoryResolver, error)
- func (s *Store) MarkAccessTokenUsed(ctx context.Context, id string) error
- func (s *Store) MarkAccountSetupTokenUsed(ctx context.Context, id string) error
- func (s *Store) MarkMessageProcessed(ctx context.Context, tenant store.Tenant, key string, at time.Time) error
- func (s *Store) MuteByMerchant(ctx context.Context, tenant store.Tenant, pattern, reason string) error
- func (s *Store) MuteTransaction(ctx context.Context, tenant store.Tenant, id string, muted bool, reason string) error
- func (s *Store) PatchCommunitySyncSettings(ctx context.Context, patch store.CommunitySyncSettingsPatch) (store.CommunitySyncSettings, error)
- func (s *Store) PatchSchedulerConfig(ctx context.Context, patch store.SchedulerConfigPatch) (store.SchedulerConfig, error)
- func (s *Store) RecordExtractionDiagnostic(ctx context.Context, tenant store.Tenant, diagnostic api.ExtractionDiagnostic) error
- func (s *Store) RemoveBucketByMerchant(ctx context.Context, tenant store.Tenant, bucket, merchant string) (int64, error)
- func (s *Store) RemoveCategoryByMerchant(ctx context.Context, tenant store.Tenant, category, merchant string) (int64, error)
- func (s *Store) RemoveLabel(ctx context.Context, tenant store.Tenant, transactionID, label string) error
- func (s *Store) RemoveLabelByMerchant(ctx context.Context, tenant store.Tenant, label, pattern string) (int64, error)
- func (s *Store) RevokeAccessToken(ctx context.Context, id, userID string) error
- func (s *Store) RevokeSession(ctx context.Context, id string) error
- func (s *Store) SearchTransactions(ctx context.Context, tenant store.Tenant, query string, ...) ([]store.Transaction, store.TransactionListResult, error)
- func (s *Store) Seed(ctx context.Context, content store.SeedContent) (api.CategoryResolver, error)
- func (s *Store) SeedMCCCategories(ctx context.Context, names []string) error
- func (s *Store) SeedMCCCodes(ctx context.Context, entries []store.MCCEntry) error
- func (s *Store) SeedMerchantCategories(ctx context.Context, entries []store.MerchantCategoryEntry) (int64, error)
- func (s *Store) SeedPredefinedRules(ctx context.Context, rules []store.RuleRow) error
- func (s *Store) SetActiveLLMProvider(ctx context.Context, tenant store.Tenant, provider string) error
- func (s *Store) SetActiveScanningReader(ctx context.Context, tenant store.Tenant, reader string) error
- func (s *Store) SetAppConfig(ctx context.Context, tenant store.Tenant, key, value string) error
- func (s *Store) SetCommunityURL(ctx context.Context, url string) error
- func (s *Store) SetLLMProviderConfig(ctx context.Context, tenant store.Tenant, provider string, ...) error
- func (s *Store) SetLLMProviderCredentials(ctx context.Context, tenant store.Tenant, provider string, credentials []byte) error
- func (s *Store) SetReaderConfig(ctx context.Context, tenant store.Tenant, reader string, ...) error
- func (s *Store) SetReaderSecret(ctx context.Context, tenant store.Tenant, reader string, secret []byte) error
- func (s *Store) SetReaderToken(ctx context.Context, tenant store.Tenant, reader string, token []byte) error
- func (s *Store) SetScanningEnabled(ctx context.Context, tenant store.Tenant, enabled bool) error
- func (s *Store) SetSyncStatus(ctx context.Context, status store.SyncStatus) error
- func (s *Store) UnmuteByPattern(ctx context.Context, tenant store.Tenant, pattern string) error
- func (s *Store) UpdateDescription(ctx context.Context, tenant store.Tenant, id, description string) error
- func (s *Store) UpdateExtractionDiagnosticStatus(ctx context.Context, tenant store.Tenant, id, status string) (*store.ExtractionDiagnosticRow, error)
- func (s *Store) UpdateLabel(ctx context.Context, tenant store.Tenant, name, color string) error
- func (s *Store) UpdateMerchantReason(ctx context.Context, tenant store.Tenant, id, reason string) error
- func (s *Store) UpdateMuteReason(ctx context.Context, tenant store.Tenant, id, reason string) error
- func (s *Store) UpdateRule(ctx context.Context, tenant store.Tenant, id string, rule store.RuleRow) (*store.RuleRow, error)
- func (s *Store) UpdateScanningState(ctx context.Context, tenant store.Tenant, update store.ScanningStateUpdate) error
- func (s *Store) UpdateTransaction(ctx context.Context, tenant store.Tenant, id string, ...) error
- func (s *Store) UpdateUser(ctx context.Context, id string, input store.UpdateUserInput) (*store.User, error)
- func (s *Store) UpdateUserPassword(ctx context.Context, id string, input store.UpdateUserPasswordInput) error
- func (s *Store) Write(ctx context.Context, batch store.IngestionBatch) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store owns the SQLite connection pool and shared repository dependencies.
func (*Store) ApplyBucketByMerchant ¶
func (*Store) ApplyCategoryByMerchant ¶
func (*Store) ApplyLabelByMerchant ¶
func (*Store) BootstrapRequired ¶
BootstrapRequired reports whether the instance has no users.
func (*Store) CategorizeMerchant ¶
func (*Store) ClearActiveLLMProvider ¶
func (*Store) ClearActiveScanningReader ¶
func (*Store) CompleteAccountSetup ¶
func (s *Store) CompleteAccountSetup(ctx context.Context, input store.CompleteAccountSetupInput) (*store.User, error)
CompleteAccountSetup updates a user and consumes a valid setup token atomically.
func (*Store) CreateAccessToken ¶
func (s *Store) CreateAccessToken(ctx context.Context, input store.CreateAccessTokenInput) (*store.AccessToken, error)
CreateAccessToken creates a programmatic access token record.
func (*Store) CreateAccountSetupToken ¶
func (s *Store) CreateAccountSetupToken(ctx context.Context, input store.CreateAccountSetupTokenInput) (*store.AccountSetupToken, error)
CreateAccountSetupToken creates a one-time account setup token record.
func (*Store) CreateBootstrapAdmin ¶
func (s *Store) CreateBootstrapAdmin(ctx context.Context, input store.CreateBootstrapAdminInput) (*store.User, error)
CreateBootstrapAdmin creates the first user as an administrator.
func (*Store) CreateBucket ¶
func (*Store) CreateCategory ¶
func (*Store) CreateLabel ¶
func (*Store) CreateRule ¶
func (*Store) CreateSession ¶
func (s *Store) CreateSession(ctx context.Context, input store.CreateSessionInput) (*store.Session, error)
CreateSession creates a browser session.
func (*Store) CreateUser ¶
CreateUser creates an instance user.
func (*Store) DeleteBucket ¶
func (*Store) DeleteCategory ¶
func (*Store) DeleteLLMProviderRuntime ¶
func (*Store) DeleteLabel ¶
func (*Store) DeleteMutedMerchant ¶
func (*Store) DeleteMutedMerchantAndUnmute ¶
func (*Store) DeleteReaderRuntime ¶
func (*Store) DeleteReaderToken ¶
func (*Store) DeleteRule ¶
func (*Store) DeleteUser ¶
DeleteUser deletes a user and all rows that depend on it.
func (*Store) EnsureScanningStateForTenant ¶
func (*Store) FindAccessTokenByHash ¶
func (s *Store) FindAccessTokenByHash(ctx context.Context, tokenHash string) (*store.AccessToken, error)
FindAccessTokenByHash finds an access token by its token hash.
func (*Store) FindAccountSetupTokenByHash ¶
func (s *Store) FindAccountSetupTokenByHash(ctx context.Context, tokenHash string) (*store.AccountSetupToken, error)
FindAccountSetupTokenByHash finds an account setup token by its hash.
func (*Store) FindSessionByHash ¶
FindSessionByHash finds a session by its token hash.
func (*Store) FindUserByEmail ¶
FindUserByEmail finds a user with case-insensitive email matching.
func (*Store) FindUserByID ¶
FindUserByID finds a user by ID.
func (*Store) GetActiveLLMProviderRuntime ¶
func (*Store) GetAnnualSpend ¶
func (*Store) GetAppConfig ¶
func (*Store) GetBucketMappings ¶
func (*Store) GetCategoryMappings ¶
func (*Store) GetChartData ¶
func (*Store) GetCommunitySyncSettings ¶
func (*Store) GetCommunityURL ¶
func (*Store) GetDashboardData ¶
func (*Store) GetExtractionDiagnostic ¶
func (*Store) GetLLMProviderConfig ¶
func (*Store) GetLLMProviderCredentials ¶
func (*Store) GetLabelMappings ¶
func (*Store) GetMonthlyBreakdownSpend ¶
func (*Store) GetMutedMerchantPatterns ¶
func (*Store) GetMutedMerchantsWithCount ¶
func (*Store) GetReaderConfig ¶
func (*Store) GetReaderSecret ¶
func (*Store) GetReaderToken ¶
func (*Store) GetScanningState ¶
func (*Store) GetSchedulerConfig ¶
func (*Store) GetSpendingHeatmap ¶
func (*Store) GetSyncStatus ¶
func (*Store) GetTransaction ¶
func (*Store) HealthCheck ¶
HealthCheck verifies that the SQLite database is reachable.
func (*Store) ImportUserRules ¶
func (*Store) IsMessageProcessed ¶
func (*Store) ListAccessTokens ¶
ListAccessTokens lists active access tokens for a user.
func (*Store) ListBuckets ¶
func (*Store) ListCategories ¶
func (*Store) ListExtractionDiagnostics ¶
func (s *Store) ListExtractionDiagnostics(ctx context.Context, tenant store.Tenant, filter store.DiagnosticFilter) ([]store.ExtractionDiagnosticRow, error)
func (*Store) ListLabels ¶
func (*Store) ListMutedMerchants ¶
func (*Store) ListRunnableScanningStates ¶
func (*Store) ListScanningStates ¶
func (*Store) ListTransactions ¶
func (s *Store) ListTransactions(ctx context.Context, tenant store.Tenant, filter store.ListFilter) ([]store.Transaction, store.TransactionListResult, error)
func (*Store) LoadCategorySnapshot ¶
func (*Store) MarkAccessTokenUsed ¶
MarkAccessTokenUsed records use of an active access token.
func (*Store) MarkAccountSetupTokenUsed ¶
MarkAccountSetupTokenUsed marks an account setup token as used.
func (*Store) MarkMessageProcessed ¶
func (*Store) MuteByMerchant ¶
func (*Store) MuteTransaction ¶
func (*Store) PatchCommunitySyncSettings ¶
func (s *Store) PatchCommunitySyncSettings(ctx context.Context, patch store.CommunitySyncSettingsPatch) (store.CommunitySyncSettings, error)
func (*Store) PatchSchedulerConfig ¶
func (s *Store) PatchSchedulerConfig(ctx context.Context, patch store.SchedulerConfigPatch) (store.SchedulerConfig, error)
func (*Store) RecordExtractionDiagnostic ¶
func (*Store) RemoveBucketByMerchant ¶
func (*Store) RemoveCategoryByMerchant ¶
func (*Store) RemoveLabel ¶
func (*Store) RemoveLabelByMerchant ¶
func (*Store) RevokeAccessToken ¶
RevokeAccessToken revokes an access token owned by a user.
func (*Store) RevokeSession ¶
RevokeSession revokes a browser session.
func (*Store) SearchTransactions ¶
func (s *Store) SearchTransactions( ctx context.Context, tenant store.Tenant, query string, filter store.ListFilter, ) ([]store.Transaction, store.TransactionListResult, error)
func (*Store) Seed ¶
func (s *Store) Seed(ctx context.Context, content store.SeedContent) (api.CategoryResolver, error)
func (*Store) SeedMCCCategories ¶
func (*Store) SeedMCCCodes ¶
func (*Store) SeedMerchantCategories ¶
func (*Store) SeedPredefinedRules ¶
func (*Store) SetActiveLLMProvider ¶
func (*Store) SetActiveScanningReader ¶
func (*Store) SetAppConfig ¶
func (*Store) SetCommunityURL ¶
func (*Store) SetLLMProviderConfig ¶
func (*Store) SetLLMProviderCredentials ¶
func (*Store) SetReaderConfig ¶
func (*Store) SetReaderSecret ¶
func (*Store) SetReaderToken ¶
func (*Store) SetScanningEnabled ¶
func (*Store) SetSyncStatus ¶
func (*Store) UnmuteByPattern ¶
func (*Store) UpdateDescription ¶
func (*Store) UpdateExtractionDiagnosticStatus ¶
func (*Store) UpdateLabel ¶
func (*Store) UpdateMerchantReason ¶
func (*Store) UpdateMuteReason ¶
func (*Store) UpdateRule ¶
func (*Store) UpdateScanningState ¶
func (*Store) UpdateTransaction ¶
func (*Store) UpdateUser ¶
func (s *Store) UpdateUser(ctx context.Context, id string, input store.UpdateUserInput) (*store.User, error)
UpdateUser updates mutable user metadata.
func (*Store) UpdateUserPassword ¶
func (s *Store) UpdateUserPassword(ctx context.Context, id string, input store.UpdateUserPasswordInput) error
UpdateUserPassword replaces a user's password hash.
Source Files
¶
- analytics_repository.go
- auth_repository.go
- community_repository.go
- connection.go
- diagnostics_repository.go
- errors.go
- filters.go
- ingestion.go
- label_repository.go
- path_permissions_unix.go
- repository_dependencies.go
- rules_repository.go
- runtime_repository.go
- scan.go
- scanning_repository.go
- seeder_repository.go
- store.go
- transaction.go
- transactions_repository.go
- values.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package migrations embeds and applies the SQLite baseline schema.
|
Package migrations embeds and applies the SQLite baseline schema. |