bunrepo

package
v0.16.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefinitionRepository

type DefinitionRepository struct {
	// contains filtered or unexported fields
}

func NewDefinitionRepository

func NewDefinitionRepository(db *bun.DB) *DefinitionRepository

func (DefinitionRepository) GetByCode

func (r DefinitionRepository) GetByCode(ctx context.Context, code string) (*T, error)

type DeliveryQueryRepository added in v0.16.0

type DeliveryQueryRepository struct {
	// contains filtered or unexported fields
}

func NewDeliveryQueryRepository added in v0.16.0

func NewDeliveryQueryRepository(db *bun.DB) *DeliveryQueryRepository

func (*DeliveryQueryRepository) GetDelivery added in v0.16.0

func (*DeliveryQueryRepository) ListDeliveries added in v0.16.0

type DeliveryRepository

type DeliveryRepository struct {
	// contains filtered or unexported fields
}

func NewDeliveryRepository

func NewDeliveryRepository(db *bun.DB) *DeliveryRepository

func (DeliveryRepository) Create

func (r DeliveryRepository) Create(ctx context.Context, record *T) error

func (*DeliveryRepository) ListByMessage

func (r *DeliveryRepository) ListByMessage(ctx context.Context, messageID uuid.UUID) ([]domain.DeliveryAttempt, error)

type EventRepository

type EventRepository struct {
	// contains filtered or unexported fields
}

func NewEventRepository

func NewEventRepository(db *bun.DB) *EventRepository

func (*EventRepository) ClaimRetry added in v0.15.0

func (r *EventRepository) ClaimRetry(ctx context.Context, id uuid.UUID, until time.Time) (bool, error)

func (*EventRepository) Create

func (*EventRepository) CreateIdempotent added in v0.15.0

func (EventRepository) GetByID

func (r EventRepository) GetByID(ctx context.Context, id uuid.UUID) (*T, error)

func (*EventRepository) GetByIdempotency added in v0.15.0

func (r *EventRepository) GetByIdempotency(ctx context.Context, scope, definitionCode, key string) (*domain.NotificationEvent, error)

func (EventRepository) List

func (r EventRepository) List(ctx context.Context, opts store.ListOptions) (store.ListResult[T], error)

func (*EventRepository) ListByPublication added in v0.15.0

func (r *EventRepository) ListByPublication(ctx context.Context, publicationID uuid.UUID) ([]domain.NotificationEvent, error)

func (*EventRepository) ListPending

func (r *EventRepository) ListPending(ctx context.Context, limit int) ([]domain.NotificationEvent, error)

func (EventRepository) SoftDelete

func (r EventRepository) SoftDelete(ctx context.Context, id uuid.UUID) error

func (EventRepository) Update

func (r EventRepository) Update(ctx context.Context, record *T) error

func (*EventRepository) UpdateStatus

func (r *EventRepository) UpdateStatus(ctx context.Context, id uuid.UUID, status string) error

type InboxRepository

type InboxRepository struct {
	// contains filtered or unexported fields
}

func NewInboxRepository

func NewInboxRepository(db *bun.DB) *InboxRepository

func (*InboxRepository) CountUnread

func (r *InboxRepository) CountUnread(ctx context.Context, userID string) (int, error)

func (InboxRepository) Create

func (r InboxRepository) Create(ctx context.Context, record *T) error

func (*InboxRepository) Dismiss

func (r *InboxRepository) Dismiss(ctx context.Context, id uuid.UUID) error

func (InboxRepository) GetByID

func (r InboxRepository) GetByID(ctx context.Context, id uuid.UUID) (*T, error)

func (InboxRepository) List

func (r InboxRepository) List(ctx context.Context, opts store.ListOptions) (store.ListResult[T], error)

func (*InboxRepository) ListByUser

func (*InboxRepository) MarkRead

func (r *InboxRepository) MarkRead(ctx context.Context, id uuid.UUID, read bool) error

func (*InboxRepository) Snooze

func (r *InboxRepository) Snooze(ctx context.Context, id uuid.UUID, until time.Time) error

func (InboxRepository) SoftDelete

func (r InboxRepository) SoftDelete(ctx context.Context, id uuid.UUID) error

func (InboxRepository) Update

func (r InboxRepository) Update(ctx context.Context, record *T) error

type MessageRepository

type MessageRepository struct {
	// contains filtered or unexported fields
}

func NewMessageRepository

func NewMessageRepository(db *bun.DB) *MessageRepository

func (MessageRepository) Create

func (r MessageRepository) Create(ctx context.Context, record *T) error

func (*MessageRepository) ListByEvent

func (r *MessageRepository) ListByEvent(ctx context.Context, eventID uuid.UUID) ([]domain.NotificationMessage, error)

type PreferenceRepository

type PreferenceRepository struct {
	// contains filtered or unexported fields
}

func NewPreferenceRepository

func NewPreferenceRepository(db *bun.DB) *PreferenceRepository

func (PreferenceRepository) Create

func (r PreferenceRepository) Create(ctx context.Context, record *T) error

func (PreferenceRepository) GetByID

func (r PreferenceRepository) GetByID(ctx context.Context, id uuid.UUID) (*T, error)

func (*PreferenceRepository) GetBySubject

func (r *PreferenceRepository) GetBySubject(ctx context.Context, subjectType, subjectID, definitionCode, channel string) (*domain.NotificationPreference, error)

func (PreferenceRepository) List

func (r PreferenceRepository) List(ctx context.Context, opts store.ListOptions) (store.ListResult[T], error)

func (PreferenceRepository) SoftDelete

func (r PreferenceRepository) SoftDelete(ctx context.Context, id uuid.UUID) error

func (PreferenceRepository) Update

func (r PreferenceRepository) Update(ctx context.Context, record *T) error

type PublicationRepository added in v0.15.0

type PublicationRepository struct {
	// contains filtered or unexported fields
}

func NewPublicationRepository added in v0.15.0

func NewPublicationRepository(db *bun.DB) *PublicationRepository

func (*PublicationRepository) Claim added in v0.15.0

func (r *PublicationRepository) Claim(ctx context.Context, id uuid.UUID, until time.Time) (bool, error)

func (*PublicationRepository) Create added in v0.15.0

func (*PublicationRepository) CreateOrAttachOpenDigest added in v0.15.0

CreateOrAttachOpenDigest keeps the publication lock and event attachment in one transaction; retaining the sequence in one function makes the ordering against Claim auditable.

func (*PublicationRepository) CreateOrGetOpenDigest added in v0.15.0

func (*PublicationRepository) FindOpenDigest added in v0.15.0

func (r *PublicationRepository) FindOpenDigest(ctx context.Context, digestKey string) (*domain.NotificationPublication, error)

func (PublicationRepository) GetByID added in v0.15.0

func (r PublicationRepository) GetByID(ctx context.Context, id uuid.UUID) (*T, error)

func (PublicationRepository) List added in v0.15.0

func (r PublicationRepository) List(ctx context.Context, opts store.ListOptions) (store.ListResult[T], error)

func (*PublicationRepository) ListPending added in v0.15.0

func (PublicationRepository) SoftDelete added in v0.15.0

func (r PublicationRepository) SoftDelete(ctx context.Context, id uuid.UUID) error

func (PublicationRepository) Update added in v0.15.0

func (r PublicationRepository) Update(ctx context.Context, record *T) error

type RetentionRepository added in v0.16.0

type RetentionRepository struct {
	// contains filtered or unexported fields
}

RetentionRepository executes each bounded purge in a single database transaction. The SQL is intentionally shared by SQLite and PostgreSQL.

func NewRetentionRepository added in v0.16.0

func NewRetentionRepository(db *bun.DB) *RetentionRepository

func (*RetentionRepository) PurgeTerminal added in v0.16.0

func (r *RetentionRepository) PurgeTerminal(
	ctx context.Context,
	cutoffs store.RetentionCutoffs,
	batchSize int,
) (store.RetentionCounts, bool, error)

type RetryOperationRepository added in v0.15.0

type RetryOperationRepository struct {
	// contains filtered or unexported fields
}

func NewRetryOperationRepository added in v0.15.0

func NewRetryOperationRepository(db *bun.DB) *RetryOperationRepository

func (*RetryOperationRepository) Claim added in v0.15.0

func (r *RetryOperationRepository) Claim(ctx context.Context, id uuid.UUID, until time.Time) (bool, error)

func (*RetryOperationRepository) Create added in v0.15.0

func (*RetryOperationRepository) CreateIdempotent added in v0.15.0

func (RetryOperationRepository) GetByID added in v0.15.0

func (r RetryOperationRepository) GetByID(ctx context.Context, id uuid.UUID) (*T, error)

func (RetryOperationRepository) List added in v0.15.0

func (r RetryOperationRepository) List(ctx context.Context, opts store.ListOptions) (store.ListResult[T], error)

func (RetryOperationRepository) SoftDelete added in v0.15.0

func (r RetryOperationRepository) SoftDelete(ctx context.Context, id uuid.UUID) error

func (RetryOperationRepository) Update added in v0.15.0

func (r RetryOperationRepository) Update(ctx context.Context, record *T) error

type SecretStore

type SecretStore struct {
	// contains filtered or unexported fields
}

func NewSecretStore

func NewSecretStore(db *bun.DB) *SecretStore

func (*SecretStore) Delete

func (s *SecretStore) Delete(ctx context.Context, scope, subjectID, channel, provider, key string) error

func (*SecretStore) GetLatest

func (s *SecretStore) GetLatest(ctx context.Context, scope, subjectID, channel, provider, key string) (iface.Record, error)

func (*SecretStore) GetVersion

func (s *SecretStore) GetVersion(ctx context.Context, scope, subjectID, channel, provider, key, version string) (iface.Record, error)

func (*SecretStore) List

func (s *SecretStore) List(ctx context.Context, scope, subjectID, channel, provider, key string) ([]iface.Record, error)

func (*SecretStore) Put

func (s *SecretStore) Put(ctx context.Context, rec iface.Record) error

type SubscriptionRepository

type SubscriptionRepository struct {
	// contains filtered or unexported fields
}

func NewSubscriptionRepository

func NewSubscriptionRepository(db *bun.DB) *SubscriptionRepository

func (SubscriptionRepository) GetByCode

func (r SubscriptionRepository) GetByCode(ctx context.Context, code string) (*T, error)

type TemplateRepository

type TemplateRepository struct {
	// contains filtered or unexported fields
}

func NewTemplateRepository

func NewTemplateRepository(db *bun.DB) *TemplateRepository

func (TemplateRepository) Create

func (r TemplateRepository) Create(ctx context.Context, record *T) error

func (*TemplateRepository) GetByCodeAndLocale

func (r *TemplateRepository) GetByCodeAndLocale(ctx context.Context, code, locale, channel string) (*domain.NotificationTemplate, error)

func (TemplateRepository) GetByID

func (r TemplateRepository) GetByID(ctx context.Context, id uuid.UUID) (*T, error)

func (TemplateRepository) List

func (r TemplateRepository) List(ctx context.Context, opts store.ListOptions) (store.ListResult[T], error)

func (*TemplateRepository) ListByCode

func (TemplateRepository) SoftDelete

func (r TemplateRepository) SoftDelete(ctx context.Context, id uuid.UUID) error

func (TemplateRepository) Update

func (r TemplateRepository) Update(ctx context.Context, record *T) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址