ticket

package
v0.0.0-...-af2943a Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balance

type Balance struct {
	bun.BaseModel `bun:"ticket_balances"`

	TicketId  int64           `bun:"ticket_id,pk,notnull"`
	AccountId int64           `bun:"account_id,pk,notnull"`
	Amount    decimal.Decimal `bun:"amount,type:numeric(200,0)"`

	Ticket  Ticket          `bun:"rel:belongs-to"`
	Account account.Account `bun:"rel:belongs-to"`
}

func (Balance) GetID

func (Balance) GetID() int64

func (Balance) LogFields

func (b Balance) LogFields() map[string]interface{}

LogFields -

func (Balance) String

func (b Balance) String() string

func (Balance) TableName

func (Balance) TableName() string

type BalanceRequest

type BalanceRequest struct {
	Limit               int64
	Offset              int64
	WithoutZeroBalances bool
}

type Repository

type Repository interface {
	List(ctx context.Context, ticketer string, limit, offset int64) ([]Ticket, error)
	Updates(ctx context.Context, req UpdatesRequest) ([]TicketUpdate, error)
	UpdatesForOperation(ctx context.Context, operationId int64) ([]TicketUpdate, error)
	BalancesForAccount(ctx context.Context, accountId int64, req BalanceRequest) ([]Balance, error)
}

type Ticket

type Ticket struct {
	bun.BaseModel `bun:"tickets"`

	ID           int64  `bun:"id,pk,notnull,autoincrement"`
	Level        int64  `bun:"level"`
	TicketerID   int64  `bun:"ticketer_id"`
	ContentType  []byte `bun:"content_type,type:bytea"`
	Content      []byte `bun:"content,type:bytea"`
	UpdatesCount int    `bun:"updates_count"`
	Hash         string `bun:"hash,unique:ticket_key"`

	Ticketer account.Account `bun:"rel:belongs-to"`
}

func (Ticket) GetHash

func (t Ticket) GetHash() string

func (Ticket) GetID

func (t Ticket) GetID() int64

func (Ticket) LogFields

func (t Ticket) LogFields() map[string]interface{}

LogFields -

func (Ticket) TableName

func (Ticket) TableName() string

type TicketUpdate

type TicketUpdate struct {
	bun.BaseModel `bun:"ticket_updates"`

	ID          int64           `bun:"id,pk,notnull,autoincrement"`
	Timestamp   time.Time       `bun:"timestamp,pk,notnull"`
	OperationId int64           `bun:"operation_id"`
	Level       int64           `bun:"level"`
	TicketId    int64           `bun:"ticket_id"`
	AccountId   int64           `bun:"account_id"`
	Amount      decimal.Decimal `bun:"amount,type:numeric(200,0)"`

	Account account.Account `bun:"rel:belongs-to"`
	Ticket  Ticket          `bun:"rel:belongs-to"`
}

TicketUpdate -

func (*TicketUpdate) GetID

func (t *TicketUpdate) GetID() int64

GetID -

func (*TicketUpdate) LogFields

func (t *TicketUpdate) LogFields() map[string]interface{}

LogFields -

func (TicketUpdate) TableName

func (TicketUpdate) TableName() string

type UpdatesRequest

type UpdatesRequest struct {
	Account  string
	Ticketer string
	TicketId *uint64
	Limit    int64
	Offset   int64
}

Jump to

Keyboard shortcuts

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