common

package
v0.3.50 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendContextField added in v0.3.46

func AppendContextField(ctx context.Context, fields []any) []any

func HTTPConnReused added in v0.3.46

func HTTPConnReused(ctx context.Context) (reused bool, ok bool)

func MaskAPIKey added in v0.3.46

func MaskAPIKey(value string) string

func ReadBodyForLog added in v0.3.46

func ReadBodyForLog(body io.Reader) string

func SanitizeHeaders added in v0.3.46

func SanitizeHeaders(header http.Header) http.Header

func SanitizeURL added in v0.3.46

func SanitizeURL(raw string, hiddenParams ...string) string

func StartRequestSpan added in v0.3.46

func StartRequestSpan(ctx context.Context, instrumentationName, spanName string) (context.Context, trace.Span)

func ToInt

func ToInt(digit interface{}) (i int, err error)

func ToInt64

func ToInt64(digit interface{}) (i int64, err error)

func ToJSONList

func ToJSONList(v []byte) []byte

ToJSONList convert v to json list if v is a map

func WithHTTPConnTrace added in v0.3.46

func WithHTTPConnTrace(ctx context.Context) context.Context

Types

type APIError

type APIError struct {
	Code    int64  `json:"code"`
	Message string `json:"msg"`
}

APIError define API error when response status is 4xx or 5xx

func (APIError) Error

func (e APIError) Error() string

Error return error code and message

func (APIError) MarshalEasyJSON added in v0.3.46

func (v APIError) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (APIError) MarshalJSON added in v0.3.46

func (v APIError) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*APIError) UnmarshalEasyJSON added in v0.3.46

func (v *APIError) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*APIError) UnmarshalJSON added in v0.3.46

func (v *APIError) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PriceLevel

type PriceLevel struct {
	Price    string
	Quantity string
}

PriceLevel is a common structure for bids and asks in the order book.

func (PriceLevel) MarshalEasyJSON added in v0.3.46

func (v PriceLevel) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PriceLevel) MarshalJSON added in v0.3.46

func (v PriceLevel) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PriceLevel) Parse

func (p *PriceLevel) Parse() (float64, float64, error)

Parse parses this PriceLevel's Price and Quantity and returns them both. It also returns an error if either fails to parse.

func (*PriceLevel) UnmarshalEasyJSON added in v0.3.46

func (v *PriceLevel) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PriceLevel) UnmarshalJSON added in v0.3.46

func (v *PriceLevel) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Jump to

Keyboard shortcuts

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