Documentation
¶
Overview ¶
Package sqlstore contains SQL-backed persistence adapters for core stores. Cached rate-limit state keys use RateLimitStateCacheKey.
Index ¶
- func RateLimitStateCacheKey(key core.RateLimitKey) (string, error)
- func RedactMetadata(metadata map[string]any) map[string]any
- type ActivityStore
- func (s *ActivityStore) List(ctx context.Context, filter core.ServicesActivityFilter) (core.ServicesActivityPage, error)
- func (s *ActivityStore) Prune(ctx context.Context, policy core.ActivityRetentionPolicy) (int, error)
- func (s *ActivityStore) Record(ctx context.Context, entry core.ServiceActivityEntry) error
- type AppendServiceEventInput
- type CachedRateLimitStateStore
- type ConnectionStore
- func (s *ConnectionStore) Create(ctx context.Context, in core.CreateConnectionInput) (core.Connection, error)
- func (s *ConnectionStore) FindByScope(ctx context.Context, providerID string, scope core.ScopeRef) ([]core.Connection, error)
- func (s *ConnectionStore) FindByScopeAndExternalAccount(ctx context.Context, providerID string, scope core.ScopeRef, ...) (core.Connection, bool, error)
- func (s *ConnectionStore) Get(ctx context.Context, id string) (core.Connection, error)
- func (s *ConnectionStore) UpdateStatus(ctx context.Context, id string, status core.ConnectionStatus, reason string) error
- type CredentialStore
- func (s *CredentialStore) GetActiveByConnection(ctx context.Context, connectionID string) (core.Credential, error)
- func (s *CredentialStore) RevokeActive(ctx context.Context, connectionID string, reason string) error
- func (s *CredentialStore) SaveNewVersion(ctx context.Context, in core.SaveCredentialInput) (core.Credential, error)
- type GrantStore
- func (s *GrantStore) AppendEvent(ctx context.Context, in core.AppendGrantEventInput) error
- func (s *GrantStore) GetLatestSnapshot(ctx context.Context, connectionID string) (core.GrantSnapshot, bool, error)
- func (s *GrantStore) SaveSnapshot(ctx context.Context, in core.SaveGrantSnapshotInput) error
- func (s *GrantStore) SaveSnapshotAndEvent(ctx context.Context, snapshot core.SaveGrantSnapshotInput, ...) error
- type InstallationStore
- func (s *InstallationStore) Get(ctx context.Context, id string) (core.Installation, error)
- func (s *InstallationStore) ListByScope(ctx context.Context, providerID string, scope core.ScopeRef) ([]core.Installation, error)
- func (s *InstallationStore) UpdateStatus(ctx context.Context, id string, status core.InstallationStatus, reason string) error
- func (s *InstallationStore) Upsert(ctx context.Context, in core.UpsertInstallationInput) (core.Installation, error)
- type NotificationDispatchStore
- type OutboxStore
- func (s *OutboxStore) Ack(ctx context.Context, eventID string) error
- func (s *OutboxStore) ClaimBatch(ctx context.Context, limit int) ([]core.LifecycleEvent, error)
- func (s *OutboxStore) Enqueue(ctx context.Context, event core.LifecycleEvent) error
- func (s *OutboxStore) Retry(ctx context.Context, eventID string, cause error, nextAttemptAt time.Time) error
- type RateLimitStateStore
- type RepositoryFactory
- func (f *RepositoryFactory) ActivityStore() *ActivityStore
- func (f *RepositoryFactory) BuildStores(persistenceClient any) (core.StoreProvider, error)
- func (f *RepositoryFactory) ConnectionStore() core.ConnectionStore
- func (f *RepositoryFactory) CredentialStore() core.CredentialStore
- func (f *RepositoryFactory) DB() *bun.DB
- func (f *RepositoryFactory) InstallationStore() core.InstallationStore
- func (f *RepositoryFactory) NotificationDispatchStore() *NotificationDispatchStore
- func (f *RepositoryFactory) OutboxStore() *OutboxStore
- func (f *RepositoryFactory) RateLimitPolicy() core.RateLimitPolicy
- func (f *RepositoryFactory) RateLimitStateStore() *RateLimitStateStore
- func (f *RepositoryFactory) SubscriptionStore() core.SubscriptionStore
- func (f *RepositoryFactory) SyncCursorStore() core.SyncCursorStore
- func (f *RepositoryFactory) SyncJobStore() *SyncJobStore
- func (f *RepositoryFactory) SyncJobStoreCore() core.SyncJobStore
- type RepositoryFactoryOption
- type ServiceEventStore
- type SubscriptionStore
- func (s *SubscriptionStore) Get(ctx context.Context, id string) (core.Subscription, error)
- func (s *SubscriptionStore) GetByChannelID(ctx context.Context, providerID, channelID string) (core.Subscription, error)
- func (s *SubscriptionStore) ListExpiring(ctx context.Context, before time.Time) ([]core.Subscription, error)
- func (s *SubscriptionStore) UpdateState(ctx context.Context, id string, status core.SubscriptionStatus, reason string) error
- func (s *SubscriptionStore) Upsert(ctx context.Context, in core.UpsertSubscriptionInput) (core.Subscription, error)
- type SyncCursorStore
- func (s *SyncCursorStore) Advance(ctx context.Context, in core.AdvanceSyncCursorInput) (core.SyncCursor, error)
- func (s *SyncCursorStore) Get(ctx context.Context, connectionID string, resourceType string, ...) (core.SyncCursor, error)
- func (s *SyncCursorStore) Upsert(ctx context.Context, in core.UpsertSyncCursorInput) (core.SyncCursor, error)
- type SyncJobStore
- func (s *SyncJobStore) Create(ctx context.Context, job core.SyncJob) (core.SyncJob, error)
- func (s *SyncJobStore) CreateSyncJob(ctx context.Context, in core.CreateSyncJobStoreInput) (core.CreateSyncJobResult, error)
- func (s *SyncJobStore) Get(ctx context.Context, id string) (core.SyncJob, error)
- func (s *SyncJobStore) GetSyncJob(ctx context.Context, id string) (core.SyncJob, error)
- func (s *SyncJobStore) Update(ctx context.Context, job core.SyncJob) (core.SyncJob, error)
- type WebhookDeliveryStore
- func (s *WebhookDeliveryStore) Claim(ctx context.Context, providerID string, deliveryID string, payload []byte, ...) (webhooks.DeliveryRecord, bool, error)
- func (s *WebhookDeliveryStore) Complete(ctx context.Context, claimID string) error
- func (s *WebhookDeliveryStore) Fail(ctx context.Context, claimID string, _ error, nextAttemptAt time.Time, ...) error
- func (s *WebhookDeliveryStore) Get(ctx context.Context, providerID string, deliveryID string) (webhooks.DeliveryRecord, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RateLimitStateCacheKey ¶
func RateLimitStateCacheKey(key core.RateLimitKey) (string, error)
RateLimitStateCacheKey returns the deterministic cache key contract for rate-limit state reads: go-services::ratelimit_state::v1::<provider>::<scope_type>::<scope_id>::<bucket_key> with each segment URL-path escaped after key normalization.
Types ¶
type ActivityStore ¶
type ActivityStore struct {
// contains filtered or unexported fields
}
func NewActivityStore ¶
func NewActivityStore(db *bun.DB) (*ActivityStore, error)
func (*ActivityStore) List ¶
func (s *ActivityStore) List(ctx context.Context, filter core.ServicesActivityFilter) (core.ServicesActivityPage, error)
func (*ActivityStore) Prune ¶
func (s *ActivityStore) Prune(ctx context.Context, policy core.ActivityRetentionPolicy) (int, error)
func (*ActivityStore) Record ¶
func (s *ActivityStore) Record(ctx context.Context, entry core.ServiceActivityEntry) error
type AppendServiceEventInput ¶
type CachedRateLimitStateStore ¶
type CachedRateLimitStateStore struct {
// contains filtered or unexported fields
}
func NewCachedRateLimitStateStore ¶
func NewCachedRateLimitStateStore( base ratelimit.StateStore, cacheService repositorycache.CacheService, ) (*CachedRateLimitStateStore, error)
func (*CachedRateLimitStateStore) Get ¶
func (s *CachedRateLimitStateStore) Get(ctx context.Context, key core.RateLimitKey) (ratelimit.State, error)
type ConnectionStore ¶
type ConnectionStore struct {
// contains filtered or unexported fields
}
func (*ConnectionStore) Create ¶
func (s *ConnectionStore) Create(ctx context.Context, in core.CreateConnectionInput) (core.Connection, error)
func (*ConnectionStore) FindByScope ¶
func (s *ConnectionStore) FindByScope(ctx context.Context, providerID string, scope core.ScopeRef) ([]core.Connection, error)
func (*ConnectionStore) FindByScopeAndExternalAccount ¶ added in v0.2.0
func (*ConnectionStore) Get ¶
func (s *ConnectionStore) Get(ctx context.Context, id string) (core.Connection, error)
func (*ConnectionStore) UpdateStatus ¶
func (s *ConnectionStore) UpdateStatus( ctx context.Context, id string, status core.ConnectionStatus, reason string, ) error
type CredentialStore ¶
type CredentialStore struct {
// contains filtered or unexported fields
}
func (*CredentialStore) GetActiveByConnection ¶
func (s *CredentialStore) GetActiveByConnection(ctx context.Context, connectionID string) (core.Credential, error)
func (*CredentialStore) RevokeActive ¶
func (*CredentialStore) SaveNewVersion ¶
func (s *CredentialStore) SaveNewVersion(ctx context.Context, in core.SaveCredentialInput) (core.Credential, error)
type GrantStore ¶
type GrantStore struct {
// contains filtered or unexported fields
}
func NewGrantStore ¶
func NewGrantStore(db *bun.DB) (*GrantStore, error)
func (*GrantStore) AppendEvent ¶
func (s *GrantStore) AppendEvent(ctx context.Context, in core.AppendGrantEventInput) error
func (*GrantStore) GetLatestSnapshot ¶
func (s *GrantStore) GetLatestSnapshot(ctx context.Context, connectionID string) (core.GrantSnapshot, bool, error)
func (*GrantStore) SaveSnapshot ¶
func (s *GrantStore) SaveSnapshot(ctx context.Context, in core.SaveGrantSnapshotInput) error
func (*GrantStore) SaveSnapshotAndEvent ¶
func (s *GrantStore) SaveSnapshotAndEvent( ctx context.Context, snapshot core.SaveGrantSnapshotInput, event *core.AppendGrantEventInput, ) error
type InstallationStore ¶
type InstallationStore struct {
// contains filtered or unexported fields
}
func NewInstallationStore ¶
func NewInstallationStore(db *bun.DB) (*InstallationStore, error)
func (*InstallationStore) Get ¶
func (s *InstallationStore) Get(ctx context.Context, id string) (core.Installation, error)
func (*InstallationStore) ListByScope ¶
func (s *InstallationStore) ListByScope( ctx context.Context, providerID string, scope core.ScopeRef, ) ([]core.Installation, error)
func (*InstallationStore) UpdateStatus ¶
func (s *InstallationStore) UpdateStatus( ctx context.Context, id string, status core.InstallationStatus, reason string, ) error
func (*InstallationStore) Upsert ¶
func (s *InstallationStore) Upsert(ctx context.Context, in core.UpsertInstallationInput) (core.Installation, error)
type NotificationDispatchStore ¶
type NotificationDispatchStore struct {
// contains filtered or unexported fields
}
func NewNotificationDispatchStore ¶
func NewNotificationDispatchStore(db *bun.DB) (*NotificationDispatchStore, error)
func (*NotificationDispatchStore) Record ¶
func (s *NotificationDispatchStore) Record(ctx context.Context, input core.NotificationDispatchRecord) error
type OutboxStore ¶
type OutboxStore struct {
// contains filtered or unexported fields
}
func NewOutboxStore ¶
func NewOutboxStore(db *bun.DB) (*OutboxStore, error)
func (*OutboxStore) ClaimBatch ¶
func (s *OutboxStore) ClaimBatch(ctx context.Context, limit int) ([]core.LifecycleEvent, error)
func (*OutboxStore) Enqueue ¶
func (s *OutboxStore) Enqueue(ctx context.Context, event core.LifecycleEvent) error
type RateLimitStateStore ¶
type RateLimitStateStore struct {
// contains filtered or unexported fields
}
func NewRateLimitStateStore ¶
func NewRateLimitStateStore(db *bun.DB) (*RateLimitStateStore, error)
func (*RateLimitStateStore) Get ¶
func (s *RateLimitStateStore) Get(ctx context.Context, key core.RateLimitKey) (ratelimit.State, error)
type RepositoryFactory ¶
type RepositoryFactory struct {
// contains filtered or unexported fields
}
func NewRepositoryFactory ¶
func NewRepositoryFactory(opts ...RepositoryFactoryOption) *RepositoryFactory
func NewRepositoryFactoryFromDB ¶
func NewRepositoryFactoryFromDB(db *bun.DB) (*RepositoryFactory, error)
func NewRepositoryFactoryFromPersistence ¶
func NewRepositoryFactoryFromPersistence(client *persistence.Client) (*RepositoryFactory, error)
func (*RepositoryFactory) ActivityStore ¶
func (f *RepositoryFactory) ActivityStore() *ActivityStore
func (*RepositoryFactory) BuildStores ¶
func (f *RepositoryFactory) BuildStores(persistenceClient any) (core.StoreProvider, error)
func (*RepositoryFactory) ConnectionStore ¶
func (f *RepositoryFactory) ConnectionStore() core.ConnectionStore
func (*RepositoryFactory) CredentialStore ¶
func (f *RepositoryFactory) CredentialStore() core.CredentialStore
func (*RepositoryFactory) DB ¶
func (f *RepositoryFactory) DB() *bun.DB
func (*RepositoryFactory) InstallationStore ¶
func (f *RepositoryFactory) InstallationStore() core.InstallationStore
func (*RepositoryFactory) NotificationDispatchStore ¶
func (f *RepositoryFactory) NotificationDispatchStore() *NotificationDispatchStore
func (*RepositoryFactory) OutboxStore ¶
func (f *RepositoryFactory) OutboxStore() *OutboxStore
func (*RepositoryFactory) RateLimitPolicy ¶
func (f *RepositoryFactory) RateLimitPolicy() core.RateLimitPolicy
func (*RepositoryFactory) RateLimitStateStore ¶
func (f *RepositoryFactory) RateLimitStateStore() *RateLimitStateStore
func (*RepositoryFactory) SubscriptionStore ¶
func (f *RepositoryFactory) SubscriptionStore() core.SubscriptionStore
func (*RepositoryFactory) SyncCursorStore ¶
func (f *RepositoryFactory) SyncCursorStore() core.SyncCursorStore
func (*RepositoryFactory) SyncJobStore ¶
func (f *RepositoryFactory) SyncJobStore() *SyncJobStore
func (*RepositoryFactory) SyncJobStoreCore ¶ added in v0.2.0
func (f *RepositoryFactory) SyncJobStoreCore() core.SyncJobStore
type RepositoryFactoryOption ¶
type RepositoryFactoryOption func(*RepositoryFactory)
func WithRateLimitStateCache ¶
func WithRateLimitStateCache(cacheService repositorycache.CacheService) RepositoryFactoryOption
type ServiceEventStore ¶
type ServiceEventStore struct {
// contains filtered or unexported fields
}
func NewServiceEventStore ¶
func NewServiceEventStore(db *bun.DB) (*ServiceEventStore, error)
func (*ServiceEventStore) Append ¶
func (s *ServiceEventStore) Append(ctx context.Context, in AppendServiceEventInput) error
type SubscriptionStore ¶
type SubscriptionStore struct {
// contains filtered or unexported fields
}
func NewSubscriptionStore ¶
func NewSubscriptionStore(db *bun.DB) (*SubscriptionStore, error)
func (*SubscriptionStore) Get ¶
func (s *SubscriptionStore) Get(ctx context.Context, id string) (core.Subscription, error)
func (*SubscriptionStore) GetByChannelID ¶
func (s *SubscriptionStore) GetByChannelID(ctx context.Context, providerID, channelID string) (core.Subscription, error)
func (*SubscriptionStore) ListExpiring ¶
func (s *SubscriptionStore) ListExpiring(ctx context.Context, before time.Time) ([]core.Subscription, error)
func (*SubscriptionStore) UpdateState ¶
func (s *SubscriptionStore) UpdateState( ctx context.Context, id string, status core.SubscriptionStatus, reason string, ) error
func (*SubscriptionStore) Upsert ¶
func (s *SubscriptionStore) Upsert(ctx context.Context, in core.UpsertSubscriptionInput) (core.Subscription, error)
type SyncCursorStore ¶
type SyncCursorStore struct {
// contains filtered or unexported fields
}
func NewSyncCursorStore ¶
func NewSyncCursorStore(db *bun.DB) (*SyncCursorStore, error)
func (*SyncCursorStore) Advance ¶
func (s *SyncCursorStore) Advance(ctx context.Context, in core.AdvanceSyncCursorInput) (core.SyncCursor, error)
func (*SyncCursorStore) Get ¶
func (s *SyncCursorStore) Get( ctx context.Context, connectionID string, resourceType string, resourceID string, ) (core.SyncCursor, error)
func (*SyncCursorStore) Upsert ¶
func (s *SyncCursorStore) Upsert(ctx context.Context, in core.UpsertSyncCursorInput) (core.SyncCursor, error)
type SyncJobStore ¶
type SyncJobStore struct {
// contains filtered or unexported fields
}
func NewSyncJobStore ¶
func NewSyncJobStore(db *bun.DB) (*SyncJobStore, error)
func (*SyncJobStore) CreateSyncJob ¶ added in v0.2.0
func (s *SyncJobStore) CreateSyncJob( ctx context.Context, in core.CreateSyncJobStoreInput, ) (core.CreateSyncJobResult, error)
func (*SyncJobStore) GetSyncJob ¶ added in v0.2.0
type WebhookDeliveryStore ¶
type WebhookDeliveryStore struct {
// contains filtered or unexported fields
}
func NewWebhookDeliveryStore ¶
func NewWebhookDeliveryStore(db *bun.DB) (*WebhookDeliveryStore, error)
func (*WebhookDeliveryStore) Complete ¶
func (s *WebhookDeliveryStore) Complete(ctx context.Context, claimID string) error
func (*WebhookDeliveryStore) Get ¶
func (s *WebhookDeliveryStore) Get( ctx context.Context, providerID string, deliveryID string, ) (webhooks.DeliveryRecord, error)
Source Files
¶
- activity_store.go
- cached_rate_limit_state_store.go
- compile_checks.go
- connection_store.go
- credential_store.go
- doc.go
- domain_adapters.go
- event_stores.go
- factory.go
- handlers.go
- installation_store.go
- models.go
- notification_dispatch_store.go
- outbox_store.go
- rate_limit_state_store.go
- redaction.go
- subscription_store.go
- sync_cursor_store.go
- sync_job_store.go
- webhook_delivery_store.go
Click to show internal directories.
Click to hide internal directories.