common

package
v0.0.0-...-9e52cca Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: GPL-3.0, Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const CurrencyVersion = 0

Variables

View Source
var (
	ErrInvalidCurrencyRequest = errors.New("kaetzchen/meson: invalid request")

	ErrWrongTicker = errors.New("meson: request ticker mismatch")
)

Functions

func RespondFailure

func RespondFailure(err error) []byte

func RespondSuccess

func RespondSuccess(message string) []byte

func ResponseFromJson

func ResponseFromJson(rawResponse []byte) (string, error)

Types

type CurrencyRequest

type CurrencyRequest struct {
	Version int
	Command uint8
	Ticker  string
	Payload []byte
}

func NewRequest

func NewRequest(command uint8, ticker string, payload []byte) *CurrencyRequest

func RequestFromJson

func RequestFromJson(rawRequest []byte) (*CurrencyRequest, error)

func (*CurrencyRequest) ToJson

func (c *CurrencyRequest) ToJson() []byte

type CurrencyResponse

type CurrencyResponse struct {
	Version int
	Message string
	Error   string
}

func NewResponse

func NewResponse(message string, errMsg string) *CurrencyResponse

func (*CurrencyResponse) ToJson

func (c *CurrencyResponse) ToJson() []byte

Jump to

Keyboard shortcuts

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