example

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
	Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
}

type KindOfCurrency

type KindOfCurrency string
const (
	USD KindOfCurrency = "USD"
	EUR KindOfCurrency = "EUR"
	GBP KindOfCurrency = "GBP"
)

type KindOfPayment

type KindOfPayment string
const (
	KOPIncoming KindOfPayment = "INCOMING"
	KOPOutgoing KindOfPayment = "OUTGOING"
	KOPInternal KindOfPayment = "INTERNAL"
	KOPUnknown  KindOfPayment = "UNKNOWN"
)

type KindOfState

type KindOfState string
const (
	KOSCreated    KindOfState = "CREATED"
	KOSDeclined   KindOfState = "DECLINED"
	KOSSucceeded  KindOfState = "SUCCEEDED"
	KOSProcessing KindOfState = "PROCESSING"
	KOSDelayed    KindOfState = "DELAYED"
	KOSAborted    KindOfState = "ABORTED"
	KOSUnknown    KindOfState = "UNKNOWN"
)

type Payment

type Payment struct {
	ID          uuid.UUID      `json:"id" db:"id"`
	UserID      string         `json:"user_id" db:"user_id"`
	Kind        KindOfPayment  `json:"kind" db:"kind"`
	State       KindOfState    `json:"state" db:"state"`
	Currency    KindOfCurrency `json:"currency" db:"currency"`
	Amount      int64          `json:"amount" db:"amount"`
	CreatedAt   time.Time      `json:"created" db:"created_at"`
	ProcessedAt *time.Time     `json:"processed" db:"processed_at"`
}

type Repository

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

func New

func New(db DB) *Repository

func (*Repository) Create

func (repo *Repository) Create(ctx context.Context, payment Payment) error

func (*Repository) FindByIDAndUserID

func (repo *Repository) FindByIDAndUserID(ctx context.Context, id uuid.UUID, userID string) (empty Payment, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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