babeltrader_utils_go

package
Version: v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 1, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeInterfaceByJson

func DecodeInterfaceByJson(data interface{}, result_pointer interface{}) error

/////////////// utils functions /////////////////

func DispatchRequests

func DispatchRequests(peer *cascade.Peer, message []byte, callbacks map[string]ReqCallback)

func DispatchResponse

func DispatchResponse(msg *cascade.HubByteMessage, callbacks map[string]RspCallback)

func HttpRequest

func HttpRequest(client *http.Client, reqType string, data string, url string, requstHeaders map[string]string) ([]byte, error)

func HttpResponse

func HttpResponse(w http.ResponseWriter, msg string, errId int64, errMsg string, data interface{})

func ReadPostBody

func ReadPostBody(r *http.Request, obj interface{}) error

func ResponseClient

func ResponseClient(peer *cascade.Peer, rsp *common.MessageRspCommon)

func ResponseError

func ResponseError(peer *cascade.Peer, errId int64, errMsg string, data interface{})

/////////////// response functions /////////////////

Types

type OrderCacheManager

type OrderCacheManager struct {
	OutsideOidMap map[string]*orderCache
}

func NewOrderCacheManager

func NewOrderCacheManager() *OrderCacheManager

func (*OrderCacheManager) AddCache

func (this *OrderCacheManager) AddCache(order *common.MessageOrder) error

func (*OrderCacheManager) CleanExpire

func (this *OrderCacheManager) CleanExpire(expireSecond int64)

func (*OrderCacheManager) GetOrder

func (this *OrderCacheManager) GetOrder(outsideOid string) (*common.MessageOrder, error)

func (*OrderCacheManager) UpdateOrderStatus

func (this *OrderCacheManager) UpdateOrderStatus(outsideOrderId string, status int) error

type PeerMsgLinker

type PeerMsgLinker struct {
	// contains filtered or unexported fields
}

func NewPeerMsgLinker

func NewPeerMsgLinker() *PeerMsgLinker

func (*PeerMsgLinker) AddPeer

func (this *PeerMsgLinker) AddPeer(peer *cascade.Peer) error

func (*PeerMsgLinker) CacheMsg

func (this *PeerMsgLinker) CacheMsg(peer *cascade.Peer, msg string) error

func (*PeerMsgLinker) CleanExpire

func (this *PeerMsgLinker) CleanExpire(expireSecond int64)

func (*PeerMsgLinker) DelPeer

func (this *PeerMsgLinker) DelPeer(peer *cascade.Peer) error

func (*PeerMsgLinker) GetMsgPeer

func (this *PeerMsgLinker) GetMsgPeer(msg string) (*cascade.Peer, error)

func (*PeerMsgLinker) OutputMsgPeer

func (this *PeerMsgLinker) OutputMsgPeer()

type ReqCallback

/////////////// handle requests /////////////////

type RspCallback

type RspCallback func(*common.MessageRspCommon, *cascade.HubByteMessage)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL