account

package
v0.0.0-...-0948bf3 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOptions

func NewOptions() *options

NewOptions new options struct

func PrintOptions

func PrintOptions(packageName string)

Types

type Account

type Account struct {
	dgo.AggBase
	// contains filtered or unexported fields
}

func New

func New(aggBase dgo.AggBase, _opts ...Option) *Account

New constructor

func (*Account) Balance

func (a *Account) Balance() uint64

func (*Account) Name

func (a *Account) Name() string

func (*Account) SetOptions

func (_a *Account) SetOptions(_opts ...Option) *Account

func (*Account) Validate

func (a *Account) Validate() error

type CreateCmd

type CreateCmd struct {
	Name       string
	Balance    uint64
	NameExists func(ctx context.Context, name string) (*Account, error)
}

func (*CreateCmd) DryRun

func (c *CreateCmd) DryRun() bool

func (*CreateCmd) Handle

func (c *CreateCmd) Handle(ctx context.Context, a *Account) error

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option option interface

func SkipOption

func SkipOption() Option

func WithBalance

func WithBalance(balance uint64) Option

WithBalance balance option of Account

func WithName

func WithName(name string) Option

WithName name option of Account

func WithOptions

func WithOptions(o *options) Option

type TransferCmd

type TransferCmd struct {
	From   dgo.ID
	To     dgo.ID
	Amount uint64
}

func NewTransferCmd

func NewTransferCmd(from dgo.ID, to dgo.ID, amount uint64) *TransferCmd

func (*TransferCmd) BatchEntries

func (c *TransferCmd) BatchEntries() (entries []*dgo.BatchEntry[*Account])

type UpdateNameCmd

type UpdateNameCmd struct {
	ID   dgo.ID
	Name string
}

func (UpdateNameCmd) Handle

func (c UpdateNameCmd) Handle(ctx context.Context, a *Account) error

Jump to

Keyboard shortcuts

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