wallet

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthTx        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTx          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthWallet        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowWallet          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupWallet = fmt.Errorf("proto: unexpected end of group")
)

Functions

This section is empty.

Types

type App

type App interface {
	Store
	// Fetch recompute all Tx data from latest computed wallet
	ComputeAndFetch(context.Context, Filter) ([]W, error)
}

App application layer for W object.

type Filter

type Filter struct {
	ID             ulid.ID
	LastBeforeDate time.Time
	StartDate      time.Time
	EndDate        time.Time
}

Filter object to fetch specific W.

type Store

type Store interface {
	Insert(context.Context, W) error
	Fetch(context.Context, Filter) (W, error)
	Remove(context.Context, Filter) error
}

Store storage layer for W object.

type Tx

type Tx struct {
	ID       github_com_elojah_wallet_pkg_ulid.ID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=github.com/elojah/wallet/pkg/ulid.ID" json:"ID"`
	WalletID github_com_elojah_wallet_pkg_ulid.ID `protobuf:"bytes,2,opt,name=WalletID,proto3,customtype=github.com/elojah/wallet/pkg/ulid.ID" json:"WalletID"`
	Sum      string                               `protobuf:"bytes,3,opt,name=Sum,proto3" json:"Sum,omitempty"`
}

func NewPopulatedTx

func NewPopulatedTx(r randyTx, easy bool) *Tx

func (*Tx) Descriptor

func (*Tx) Descriptor() ([]byte, []int)

func (*Tx) Equal

func (this *Tx) Equal(that interface{}) bool

func (*Tx) GetSum

func (m *Tx) GetSum() string

func (*Tx) GoString

func (this *Tx) GoString() string

func (*Tx) Marshal

func (m *Tx) Marshal() (dAtA []byte, err error)

func (*Tx) MarshalTo

func (m *Tx) MarshalTo(dAtA []byte) (int, error)

func (*Tx) MarshalToSizedBuffer

func (m *Tx) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Tx) ProtoMessage

func (*Tx) ProtoMessage()

func (*Tx) Reset

func (m *Tx) Reset()

func (*Tx) Size

func (m *Tx) Size() (n int)

func (*Tx) String

func (this *Tx) String() string

func (*Tx) Unmarshal

func (m *Tx) Unmarshal(dAtA []byte) error

func (*Tx) XXX_DiscardUnknown

func (m *Tx) XXX_DiscardUnknown()

func (*Tx) XXX_Marshal

func (m *Tx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Tx) XXX_Merge

func (m *Tx) XXX_Merge(src proto.Message)

func (*Tx) XXX_Size

func (m *Tx) XXX_Size() int

func (*Tx) XXX_Unmarshal

func (m *Tx) XXX_Unmarshal(b []byte) error

type TxApp

type TxApp interface {
	TxStore
	CreateTx(context.Context, Tx) error
}

TxApp applicatino layer for Tx.

type TxFilter

type TxFilter struct {
	WalletID  ulid.ID
	StartDate time.Time
	EndDate   time.Time
}

Filter object to fetch specific Txs.

type TxStore

type TxStore interface {
	InsertTx(context.Context, Tx) error
	FetchManyTx(context.Context, TxFilter) ([]Tx, error)
}

TxStore storage layer for Tx object.

type W

type W struct {
	ID        github_com_elojah_wallet_pkg_ulid.ID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=github.com/elojah/wallet/pkg/ulid.ID" json:"ID"`
	Timestamp int64                                `protobuf:"varint,2,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"`
	Amount    string                               `protobuf:"bytes,3,opt,name=Amount,proto3" json:"Amount,omitempty"`
}

func GenerateHourRange

func GenerateHourRange(start time.Time, end time.Time) []W

GenerateHourRange generates a slice of wallets at hours end (e.g: 10:00, 22:00) from a date range !!! Amounts are always empty and need to be populated.

func NewPopulatedW

func NewPopulatedW(r randyWallet, easy bool) *W

func (*W) Descriptor

func (*W) Descriptor() ([]byte, []int)

func (*W) Equal

func (this *W) Equal(that interface{}) bool

func (*W) GetAmount

func (m *W) GetAmount() string

func (*W) GetTimestamp

func (m *W) GetTimestamp() int64

func (*W) GoString

func (this *W) GoString() string

func (*W) Marshal

func (m *W) Marshal() (dAtA []byte, err error)

func (*W) MarshalTo

func (m *W) MarshalTo(dAtA []byte) (int, error)

func (*W) MarshalToSizedBuffer

func (m *W) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*W) ProtoMessage

func (*W) ProtoMessage()

func (*W) Reset

func (m *W) Reset()

func (*W) Size

func (m *W) Size() (n int)

func (*W) String

func (this *W) String() string

func (*W) Unmarshal

func (m *W) Unmarshal(dAtA []byte) error

func (*W) XXX_DiscardUnknown

func (m *W) XXX_DiscardUnknown()

func (*W) XXX_Marshal

func (m *W) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*W) XXX_Merge

func (m *W) XXX_Merge(src proto.Message)

func (*W) XXX_Size

func (m *W) XXX_Size() int

func (*W) XXX_Unmarshal

func (m *W) XXX_Unmarshal(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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