Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
Functions ¶
This section is empty.
Types ¶
type APITokenRepository ¶
type APITokenRepository interface {
Create(ctx context.Context, token model.APIToken) (model.APIToken, error)
GetByID(ctx context.Context, id string) (model.APIToken, error)
GetByTokenHash(ctx context.Context, tokenHash string) (model.APIToken, error)
ListByUser(ctx context.Context, userID string) ([]model.APIToken, error)
Update(ctx context.Context, token model.APIToken) (model.APIToken, error)
Delete(ctx context.Context, id string) error
}
type ContactRepository ¶ added in v1.0.10
type ErrUnknownDriver ¶
type ErrUnknownDriver struct {
Driver string
}
func (*ErrUnknownDriver) Error ¶
func (e *ErrUnknownDriver) Error() string
type EventLogRepository ¶
type HistorySyncRepository ¶
type HistorySyncRepository interface {
Create(ctx context.Context, payload model.WhatsappHistorySync) (model.WhatsappHistorySync, error)
ListPendingByInstance(ctx context.Context, instanceID string) ([]model.WhatsappHistorySync, error)
ListPendingByCycle(ctx context.Context, instanceID, cycleID string) ([]model.WhatsappHistorySync, error)
UpdateStatus(ctx context.Context, id string, status model.HistorySyncPayloadStatus, processedAt *time.Time) error
DeleteByInstance(ctx context.Context, instanceID string) error
}
type IdempotencyRepository ¶ added in v1.2.0
type IdempotencyRepository interface {
// TryAcquire inserts the key and reports whether this caller owns the
// request. When it does not, the stored record comes back for replay.
TryAcquire(ctx context.Context, record model.IdempotencyRecord) (bool, model.IdempotencyRecord, error)
Complete(ctx context.Context, instanceID, key string, responseStatus int, responseBody string) error
Release(ctx context.Context, instanceID, key string) error
DeleteExpired(ctx context.Context, now time.Time) (int64, error)
}
type InstanceRepository ¶
type InstanceRepository interface {
Create(ctx context.Context, instance model.Instance) (model.Instance, error)
GetByID(ctx context.Context, id string) (model.Instance, error)
GetByTokenHash(ctx context.Context, tokenHash string) (model.Instance, error)
List(ctx context.Context, query string, limit, offset int) ([]model.Instance, int, error)
ListByOwner(ctx context.Context, ownerUserID string, query string, limit, offset int) ([]model.Instance, int, error)
Update(ctx context.Context, instance model.Instance) (model.Instance, error)
Delete(ctx context.Context, id string) error
}
type MessageRepository ¶
type MessageRepository interface {
Create(ctx context.Context, message model.Message) (model.Message, error)
ListByInstance(ctx context.Context, instanceID string) ([]model.Message, error)
Update(ctx context.Context, msg model.Message) error
UpdateStatusByWhatsAppID(ctx context.Context, whatsappID string, status string) error
GetByWhatsAppID(ctx context.Context, whatsappID string) (model.Message, error)
GetPendingMessages(ctx context.Context, limit int) ([]model.Message, error)
DeleteByInstanceID(ctx context.Context, instanceID string) error
}
type Repositories ¶
type Repositories struct {
Instance InstanceRepository
Message MessageRepository
EventLog EventLogRepository
User UserRepository
APIToken APITokenRepository
HistorySync HistorySyncRepository
Contact ContactRepository
Idempotency IdempotencyRepository
RedisClient *storage_redis.Client
WebhookQueue queue.Queue
OutboxQueue queue.Queue
RateLimiter ratelimiter.Limiter
}
func NewRepositories ¶
type UserRepository ¶
type UserRepository interface {
Create(ctx context.Context, user model.User) (model.User, error)
GetByID(ctx context.Context, id string) (model.User, error)
GetByEmail(ctx context.Context, email string) (model.User, error)
List(ctx context.Context, query string, limit, offset int) ([]model.User, int, error)
UpdatePassword(ctx context.Context, id, passwordHash string) error
Delete(ctx context.Context, id string) error
}
Click to show internal directories.
Click to hide internal directories.