shad-go/ledger/model.go
2022-03-31 14:19:47 +03:00

21 lines
436 B
Go

package ledger
import (
"context"
"errors"
)
type (
ID string
Money int64
)
var ErrNoMoney = errors.New("no money")
type Ledger interface {
CreateAccount(ctx context.Context, id ID) error
GetBalance(ctx context.Context, id ID) (Money, error)
Deposit(ctx context.Context, id ID, amount Money) error
Withdraw(ctx context.Context, id ID, amount Money) error
Transfer(ctx context.Context, from, to ID, amount Money) error
}