Documentation ¶
Index ¶
- Variables
- func CoerceInterfaceMapToStringMap(in interface{}) (interface{}, error)
- func ParseStandardCBOR(b []byte) (a interface{}, err error)
- type AddressCollection
- type Configuration
- type Cron
- type Duration
- func (d Duration) Before(t time.Time) time.Time
- func (d Duration) Duration() time.Duration
- func (d Duration) IsInstant() bool
- func (d Duration) MarshalJSON() ([]byte, error)
- func (d *Duration) Scan(v interface{}) (err error)
- func (d Duration) Shorter(od Duration) bool
- func (d Duration) String() string
- func (d *Duration) UnmarshalJSON(input []byte) error
- func (d Duration) Value() (driver.Value, error)
- type Interval
- type JSON
- func (j JSON) Add(insertKey string, insertValue interface{}) (JSON, error)
- func (j JSON) AsMap() (map[string]interface{}, error)
- func (j JSON) Bytes() []byte
- func (j JSON) CBOR() ([]byte, error)
- func (j JSON) Delete(key string) (JSON, error)
- func (JSON) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (JSON) GormDataType() string
- func (j JSON) MarshalJSON() ([]byte, error)
- func (j JSON) MultiAdd(keyValues KV) (JSON, error)
- func (j JSON) PrependAtArrayKey(insertKey string, insertValue interface{}) (JSON, error)
- func (j *JSON) Scan(value interface{}) error
- func (j *JSON) UnmarshalJSON(b []byte) error
- func (j *JSON) UnmarshalTOML(val interface{}) error
- func (j JSON) Value() (driver.Value, error)
- type JSONAPIError
- type JSONAPIErrors
- type KV
- type SendEtherRequest
- type Sha256Hash
- type WebURL
Constants ¶
This section is empty.
Variables ¶
var CronParser cron.Parser
CronParser is the global parser for crontabs. It accepts the standard 5 field cron syntax as well as an optional 6th field at the front to represent seconds.
Functions ¶
func CoerceInterfaceMapToStringMap ¶ added in v1.10.16
func CoerceInterfaceMapToStringMap(in interface{}) (interface{}, error)
CoerceInterfaceMapToStringMap converts map[interface{}]interface{} (interface maps) to map[string]interface{} (string maps) and []interface{} with interface maps to string maps. Relevant when serializing between CBOR and JSON.
It also handles the CBOR 'bignum' type as documented here: https://tools.ietf.org/html/rfc7049#section-2.4.2
func ParseStandardCBOR ¶ added in v1.10.17
ParseStandardCBOR parses CBOR in "standards compliant" mode. Literal values are passed through "as-is". The input is not assumed to be a map. Empty inputs will return nil.
Types ¶
type AddressCollection ¶
AddressCollection is an array of common.Address serializable to and from a database.
func (*AddressCollection) Scan ¶
func (r *AddressCollection) Scan(value interface{}) error
Scan parses the database value as a string.
func (AddressCollection) ToStrings ¶
func (r AddressCollection) ToStrings() []string
ToStrings returns this address collection as an array of strings.
type Configuration ¶ added in v1.10.16
type Configuration struct { ID int64 `gorm:"primary_key"` Name string `gorm:"not null;unique;index"` Value string `gorm:"not null"` CreatedAt time.Time UpdatedAt time.Time DeletedAt *gorm.DeletedAt }
Configuration stores key value pairs for overriding global configuration
type Cron ¶
type Cron string
Cron holds the string that will represent the spec of the cron-job.
func (*Cron) UnmarshalJSON ¶
UnmarshalJSON parses the raw spec stored in JSON-encoded data and stores it to the Cron string.
type Duration ¶ added in v1.10.16
type Duration struct {
// contains filtered or unexported fields
}
Duration is a non-negative time duration.
func MustMakeDuration ¶ added in v1.10.16
func (Duration) Duration ¶ added in v1.10.16
Duration returns the value as the standard time.Duration value.
func (Duration) MarshalJSON ¶ added in v1.10.16
MarshalJSON implements the json.Marshaler interface.
func (Duration) Shorter ¶ added in v1.10.16
Shorter returns true if and only if d is shorter than od.
func (Duration) String ¶ added in v1.10.16
String returns a string representing the duration in the form "72h3m0.5s". Leading zero units are omitted. As a special case, durations less than one second format use a smaller unit (milli-, micro-, or nanoseconds) to ensure that the leading digit is non-zero. The zero duration formats as 0s.
func (*Duration) UnmarshalJSON ¶ added in v1.10.16
UnmarshalJSON implements the json.Unmarshaler interface.
type Interval ¶ added in v1.10.16
Interval represents a time.Duration stored as a Postgres interval type
func (Interval) MarshalText ¶ added in v1.10.16
MarshalText implements the text.Marshaler interface.
func (*Interval) UnmarshalText ¶ added in v1.10.16
UnmarshalText implements the text.Unmarshaler interface.
type JSON ¶
JSON stores the json types string, number, bool, and null. Arrays and Objects are returned as their raw json types.
func Merge ¶ added in v1.10.16
Merge returns a new map with all keys merged from left to right On conflicting keys, rightmost inputs will clobber leftmost inputs
func MustParseJSON ¶ added in v1.10.16
func ParseDietCBOR ¶ added in v1.10.17
ParseDietCBOR attempts to coerce the input byte array into valid CBOR and then coerces it into a JSON object. Assumes the input is "diet" CBOR which is like CBOR, except: 1. It is guaranteed to always be a map 2. It may or may not include the opening and closing markers "{}"
func ParseJSON ¶
ParseJSON attempts to coerce the input byte array into valid JSON and parse it into a JSON object.
func (JSON) GormDBDataType ¶ added in v1.10.16
GormDBDataType gorm db data type
func (JSON) GormDataType ¶ added in v1.10.16
func (JSON) MarshalJSON ¶
MarshalJSON returns the JSON data if it already exists, returns an empty JSON object as bytes if not.
func (JSON) MultiAdd ¶ added in v1.10.16
MultiAdd returns a new instance of j with the new values added.
func (JSON) PrependAtArrayKey ¶ added in v1.10.16
func (*JSON) UnmarshalJSON ¶
UnmarshalJSON parses the JSON bytes and stores in the *JSON pointer.
func (*JSON) UnmarshalTOML ¶ added in v1.10.16
type JSONAPIError ¶
type JSONAPIError struct {
Detail string `json:"detail"`
}
JSONAPIError is an individual JSONAPI Error.
type JSONAPIErrors ¶
type JSONAPIErrors struct {
Errors []JSONAPIError `json:"errors"`
}
JSONAPIErrors holds errors conforming to the JSONAPI spec.
func NewJSONAPIErrors ¶
func NewJSONAPIErrors() *JSONAPIErrors
NewJSONAPIErrors creates an instance of JSONAPIErrors, with the intention of managing a collection of them.
func NewJSONAPIErrorsWith ¶
func NewJSONAPIErrorsWith(detail string) *JSONAPIErrors
NewJSONAPIErrorsWith creates an instance of JSONAPIErrors populated with this single detail.
func (*JSONAPIErrors) Add ¶
func (jae *JSONAPIErrors) Add(detail string)
Add adds a new error to JSONAPIErrors with the passed detail.
func (*JSONAPIErrors) CoerceEmptyToNil ¶
func (jae *JSONAPIErrors) CoerceEmptyToNil() error
CoerceEmptyToNil will return nil if JSONAPIErrors has no errors.
func (*JSONAPIErrors) Error ¶
func (jae *JSONAPIErrors) Error() string
Error collapses the collection of errors into a collection of comma separated strings.
func (*JSONAPIErrors) Merge ¶
func (jae *JSONAPIErrors) Merge(e error)
Merge combines the arrays of the passed error if it is of type JSONAPIErrors, otherwise simply adds a single error with the error string as detail.
type KV ¶ added in v1.10.16
type KV map[string]interface{}
KV represents a key/value pair to be added to a JSON object
type SendEtherRequest ¶
type SendEtherRequest struct { DestinationAddress common.Address `json:"address"` FromAddress common.Address `json:"from"` Amount assets.Eth `json:"amount"` EVMChainID *utils.Big `json:"evmChainID"` }
SendEtherRequest represents a request to transfer ETH.
type Sha256Hash ¶ added in v1.10.16
type Sha256Hash [32]byte
Explicit type indicating a 32-byte sha256 hash
func MustSha256HashFromHex ¶ added in v1.10.16
func MustSha256HashFromHex(x string) Sha256Hash
func Sha256HashFromHex ¶ added in v1.10.16
func Sha256HashFromHex(x string) (Sha256Hash, error)
func (Sha256Hash) MarshalJSON ¶ added in v1.10.16
func (s Sha256Hash) MarshalJSON() ([]byte, error)
MarshalJSON converts a Sha256Hash to a JSON byte slice.
func (*Sha256Hash) Scan ¶ added in v1.10.16
func (s *Sha256Hash) Scan(value interface{}) error
func (Sha256Hash) String ¶ added in v1.10.16
func (s Sha256Hash) String() string
func (*Sha256Hash) UnmarshalJSON ¶ added in v1.10.16
func (s *Sha256Hash) UnmarshalJSON(input []byte) error
UnmarshalJSON converts a bytes slice of JSON to a TaskType.
func (*Sha256Hash) UnmarshalText ¶ added in v1.10.16
func (s *Sha256Hash) UnmarshalText(bs []byte) error
type WebURL ¶
WebURL contains the URL of the endpoint.
func (WebURL) MarshalJSON ¶
MarshalJSON returns the JSON-encoded string of the given data.
func (*WebURL) UnmarshalJSON ¶
UnmarshalJSON parses the raw URL stored in JSON-encoded data to a URL structure and sets it to the URL field.