storage

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB

func DB(ctx context.Context) (*sqlx.DB, error)

DB will return the sqlx.DB in use for the email module. This enables reuse from outside without exposing implementation detail.

func Migrate

func Migrate(ctx context.Context, db *sqlx.DB, schema fs.FS) error

Types

type EmailStorage

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

EmailStorage handles database operations for emails

func NewEmailStorage

func NewEmailStorage(handle *sqlx.DB) *EmailStorage

NewEmailStorage creates a new email storage instance

func NewEmailStorageErr

func NewEmailStorageErr(ctx context.Context) (*EmailStorage, error)

NewEmailStorageErr returns a user storage and any error creating the database.

func (*EmailStorage) Create

func (s *EmailStorage) Create(ctx context.Context, email *model.Email) error

Create inserts a new email into the email table

func (*EmailStorage) Get

func (s *EmailStorage) Get(ctx context.Context, id string) (*model.Email, error)

Get retrieves an email by ID from email

func (*EmailStorage) GetFailed

func (s *EmailStorage) GetFailed(ctx context.Context, limit int) ([]model.Email, error)

GetFailed retrieves failed emails from email_failed table (for audit/records)

func (*EmailStorage) GetPending

func (s *EmailStorage) GetPending(ctx context.Context, limit int) ([]model.Email, error)

GetPending retrieves all pending emails from email

func (*EmailStorage) GetSent

func (s *EmailStorage) GetSent(ctx context.Context, limit int) ([]model.Email, error)

GetSent retrieves sent emails from email_sent table (for audit/records)

func (*EmailStorage) Update

func (s *EmailStorage) Update(ctx context.Context, email *model.Email) error

Update updates an email's status in email If email is marked as sent, it moves to email_sent table If email is marked as failed, it moves to email_failed table

Jump to

Keyboard shortcuts

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