storage

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 15 Imported by: 0

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 DeviceConfigRepository

type DeviceConfigRepository interface {
	Get(ctx context.Context) (model.DeviceConfig, error)
	Update(ctx context.Context, config model.DeviceConfig) (model.DeviceConfig, error)
}

type ErrUnknownDriver

type ErrUnknownDriver struct {
	Driver string
}

func (*ErrUnknownDriver) Error

func (e *ErrUnknownDriver) Error() string

type EventLogRepository

type EventLogRepository interface {
	Create(ctx context.Context, eventLog model.EventLog) (model.EventLog, error)
	ListByInstance(ctx context.Context, instanceID string) ([]model.EventLog, error)
	DeleteByInstanceID(ctx context.Context, instanceID string) error
}

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 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) ([]model.Instance, error)
	ListByOwner(ctx context.Context, ownerUserID string) ([]model.Instance, 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
	DeleteByInstanceID(ctx context.Context, instanceID string) error
}

type Repositories

type Repositories struct {
	Instance     InstanceRepository
	Message      MessageRepository
	EventLog     EventLogRepository
	User         UserRepository
	APIToken     APITokenRepository
	DeviceConfig DeviceConfigRepository
	HistorySync  HistorySyncRepository
	RedisClient  *storage_redis.Client
	WebhookQueue queue.Queue
	RateLimiter  ratelimiter.Limiter
}

func NewRepositories

func NewRepositories(cfg config.Config, log *zap.Logger) (*Repositories, error)

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) ([]model.User, error)
	UpdatePassword(ctx context.Context, id, passwordHash string) error
	Delete(ctx context.Context, id string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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