core

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

type Broker struct {
	ID        int64          `sql:"PRIMARY_KEY" json:"id,omitempty"`
	CreatedAt time.Time      `json:"created_at,omitempty"`
	UpdatedAt time.Time      `json:"updated_at,omitempty"`
	WalletID  string         `sql:"size:36" json:"wallet_id,omitempty"`
	UserID    string         `sql:"size:36" json:"user_id,omitempty"`
	Pin       string         `sql:"size:255" json:"pin,omitempty"`
	Data      types.JSONText `sql:"type:varchar(512)" json:"data,omitempty"`
}

func (*Broker) MixinClient

func (b *Broker) MixinClient() *mixin.Client

type BrokerService

type BrokerService interface {
	Create(ctx context.Context, name, pin string) (*Broker, error)
}

type BrokerStore

type BrokerStore interface {
	Create(ctx context.Context, broker *Broker) error
	Find(ctx context.Context, walletID string) (*Broker, error)
}

type Message

type Message struct {
	ID        int64          `sql:"PRIMARY_KEY" json:"id,omitempty"`
	CreatedAt time.Time      `json:"created_at,omitempty"`
	MessageID string         `sql:"size:36" json:"message_id,omitempty"`
	UserID    string         `sql:"size:36" json:"user_id,omitempty"`
	Raw       types.JSONText `sql:"type:TEXT" json:"raw,omitempty"`
}

func BuildMessage

func BuildMessage(req *mixin.MessageRequest) *Message

type MessageService

type MessageService interface {
	Send(ctx context.Context, messages []*Message) error
	Meet(ctx context.Context, userID string) error
}

type MessageStore

type MessageStore interface {
	Create(ctx context.Context, messages []*Message) error
	List(ctx context.Context, limit int) ([]*Message, error)
	Delete(ctx context.Context, messages []*Message) error
}

type Order

type Order struct {
	ID        int64           `sql:"PRIMARY_KEY" json:"id,omitempty"`
	CreatedAt time.Time       `json:"created_at,omitempty"`
	UpdatedAt time.Time       `json:"updated_at,omitempty"`
	State     OrderState      `json:"state,omitempty"`
	UserID    string          `sql:"size:36" json:"user_id,omitempty"`
	AssetID   string          `sql:"size:36" json:"asset_id,omitempty"`
	TraceID   string          `sql:"size:36" json:"trace_id,omitempty"`
	BrokerID  string          `sql:"size:36" json:"broker_id,omitempty"`
	Amount    decimal.Decimal `sql:"type:decimal(64,8)" json:"amount,omitempty"`
	Memo      string          `sql:"size:140" json:"memo,omitempty"`
	MtgMemo   string          `sql:"size:200" json:"mtg_memo,omitempty"`
}

type OrderService

type OrderService interface {
	Pull(ctx context.Context, checkpoint time.Time, limit int) ([]*Order, error)
}

type OrderState

type OrderState int
const (
	OrderStateRejected OrderState
	OrderStateApproved
)

type OrderStore

type OrderStore interface {
	Create(ctx context.Context, order *Order) error
}

type Perm

type Perm int
const (
	PermRead Perm = 1 << iota
	PermWrite
	PermSystem
)

func (Perm) Read

func (p Perm) Read() bool

func (Perm) System

func (p Perm) System() bool

func (Perm) Write

func (p Perm) Write() bool

type Render

type Render interface {
	BrokerCreated(w io.Writer, broker *Broker) error
}

type Transfer

type Transfer struct {
	ID        int64           `sql:"PRIMARY_KEY" json:"id,omitempty"`
	CreatedAt time.Time       `json:"created_at,omitempty"`
	BrokerID  string          `sql:"size:36" json:"broker_id,omitempty"`
	TraceID   string          `sql:"size:36" json:"trace_id,omitempty"`
	AssetID   string          `sql:"size:36" json:"asset_id,omitempty"`
	Memo      string          `sql:"size:200" json:"memo,omitempty"`
	Amount    decimal.Decimal `sql:"type:decimal(64,8)" json:"amount,omitempty"`
	// 如果是空的,则是转账给多签节点
	OpponentID string `sql:"size:36" json:"opponent_id,omitempty"`
}

type TransferService

type TransferService interface {
	Handle(ctx context.Context, transfer *Transfer) error
}

type TransferStore

type TransferStore interface {
	Create(ctx context.Context, transfer *Transfer) error
	Delete(ctx context.Context, transfers []*Transfer) error
	List(ctx context.Context, limit int) ([]*Transfer, error)
}

Jump to

Keyboard shortcuts

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