Documentation ¶
Index ¶
- Constants
- func CreateTestClient(client *http.Client, fn RoundTripFunc)
- func FormatERC20Balance(balance *big.Int) string
- func HTTPWithRetries(req *HTTPFetchRequest) ([]byte, error)
- func ParseLoggingConfig(file string) error
- func ParsePayload(payload []byte, args [][]string) ([]float64, error)
- func ParseQueryString(_query string) (url string, args [][]string)
- type ContextKey
- type Entry
- type HTTPFetchRequest
- type LogConfig
- type LogLevel
- type Logger
- type QueryStruct
- type RoundTripFunc
Constants ¶
const ( //GET is a GET request type GET = iota + 1 //POST is a POST request type POST )
Variables ¶
This section is empty.
Functions ¶
func CreateTestClient ¶
func CreateTestClient(client *http.Client, fn RoundTripFunc)
CreateTestClient returns *http.Client with Transport replaced to avoid making real calls
func FormatERC20Balance ¶
func HTTPWithRetries ¶
func HTTPWithRetries(req *HTTPFetchRequest) ([]byte, error)
HTTPWithRetries will keep trying the given request until non-error result or timeout
func ParseLoggingConfig ¶
ParseLoggingConfig parses the given JSON log level config file for use in log configuration
func ParsePayload ¶
ParsePayload will extract the value from a query payload
func ParseQueryString ¶
ParseQueryString extracts the url and any args for extract values from query result payload
Types ¶
type ContextKey ¶
type ContextKey string
ContextKey string key for context value lookups
func NewKey ¶
func NewKey(pkg string, name string) ContextKey
NewKey creates a new context string key using a package and name designator
type HTTPFetchRequest ¶
HTTPFetchRequest holds info for a request
type LogConfig ¶
type LogConfig struct {
// contains filtered or unexported fields
}
LogConfig holds individual log level settings
func GetLoggingConfig ¶
func GetLoggingConfig() *LogConfig
GetLoggingConfig retrieves a shared logging config
type LogLevel ¶
type LogLevel uint
LogLevel represents possible log levels
func StringToLevel ¶
StringToLevel converts a string named log level into a level ot use for setting log levels
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is the log implementation that wraps underlying logging mechanism
func NewLogger ¶
NewLogger creates a log instance for the given component with the given log level enabled
type QueryStruct ¶
type QueryStruct struct { Order []int Arrays interface{} `json:"-"` Arguments map[string]interface{} `json:"-"` }
QueryStruct holds query result fields as a map
type RoundTripFunc ¶
RoundTripFunc The mock interface to implement. Can be configured to return a hardcoded response or a response that depends on the request