models

package
v1.11.0-beta0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: MIT Imports: 14 Imported by: 32

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
var EmptySha256Hash = new(Sha256Hash)

Functions

This section is empty.

Types

type AddressCollection

type AddressCollection []common.Address

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.

func (AddressCollection) Value

func (r AddressCollection) Value() (driver.Value, error)

Value returns the string value to be written to the database.

type Cron

type Cron string

Cron holds the string that will represent the spec of the cron-job.

func (Cron) String

func (c Cron) String() string

String returns the current Cron spec string.

func (*Cron) UnmarshalJSON

func (c *Cron) UnmarshalJSON(b []byte) error

UnmarshalJSON parses the raw spec stored in JSON-encoded data and stores it to the Cron string.

type Duration added in v0.8.2

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

Duration is a non-negative time duration.

func MakeDuration added in v0.8.3

func MakeDuration(d time.Duration) (Duration, error)

func MustMakeDuration added in v0.8.3

func MustMakeDuration(d time.Duration) Duration

func MustNewDuration added in v1.6.0

func MustNewDuration(d time.Duration) *Duration

func ParseDuration added in v1.6.0

func ParseDuration(s string) (Duration, error)

func (Duration) Before added in v0.8.3

func (d Duration) Before(t time.Time) time.Time

Before returns the time d units before time t

func (Duration) Duration added in v0.8.2

func (d Duration) Duration() time.Duration

Duration returns the value as the standard time.Duration value.

func (Duration) IsInstant added in v0.8.3

func (d Duration) IsInstant() bool

IsInstant is true if and only if d is of duration 0

func (Duration) MarshalJSON added in v0.8.2

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Duration) MarshalText added in v1.6.0

func (d Duration) MarshalText() ([]byte, error)

MarshalText implements the text.Marshaler interface.

func (*Duration) Scan added in v0.8.3

func (d *Duration) Scan(v interface{}) (err error)

func (Duration) Shorter added in v0.8.3

func (d Duration) Shorter(od Duration) bool

Shorter returns true if and only if d is shorter than od.

func (Duration) String added in v0.8.2

func (d Duration) String() string

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 v0.8.2

func (d *Duration) UnmarshalJSON(input []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Duration) UnmarshalText added in v1.6.0

func (d *Duration) UnmarshalText(input []byte) error

UnmarshalText implements the text.Unmarshaler interface.

func (Duration) Value added in v0.8.3

func (d Duration) Value() (driver.Value, error)

type Interval added in v0.9.3

type Interval time.Duration

Interval represents a time.Duration stored as a Postgres interval type

func NewInterval added in v1.2.0

func NewInterval(d time.Duration) *Interval

NewInterval creates Interval for specified duration

func (Interval) Duration added in v1.0.0

func (i Interval) Duration() time.Duration

func (Interval) IsZero added in v0.9.7

func (i Interval) IsZero() bool

func (Interval) MarshalText added in v0.9.3

func (i Interval) MarshalText() ([]byte, error)

MarshalText implements the text.Marshaler interface.

func (*Interval) Scan added in v0.9.3

func (i *Interval) Scan(v interface{}) error

func (*Interval) UnmarshalText added in v0.9.3

func (i *Interval) UnmarshalText(input []byte) error

UnmarshalText implements the text.Unmarshaler interface.

func (Interval) Value added in v0.9.3

func (i Interval) Value() (driver.Value, error)

type JSON

type JSON struct {
	gjson.Result
}

JSON stores the json types string, number, bool, and null. Arrays and Objects are returned as their raw json types.

func Merge added in v0.8.2

func Merge(inputs ...JSON) (JSON, error)

Merge returns a new map with all keys merged from left to right On conflicting keys, rightmost inputs will clobber leftmost inputs

func ParseJSON

func ParseJSON(b []byte) (JSON, error)

ParseJSON attempts to coerce the input byte array into valid JSON and parse it into a JSON object.

func (JSON) Bytes

func (j JSON) Bytes() []byte

Bytes returns the raw JSON.

func (JSON) MarshalJSON

func (j JSON) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON data if it already exists, returns an empty JSON object as bytes if not.

func (*JSON) Scan

func (j *JSON) Scan(value interface{}) error

Scan reads the database value and returns an instance.

func (*JSON) UnmarshalJSON

func (j *JSON) UnmarshalJSON(b []byte) error

UnmarshalJSON parses the JSON bytes and stores in the *JSON pointer.

func (*JSON) UnmarshalTOML added in v0.9.3

func (j *JSON) UnmarshalTOML(val interface{}) error

func (JSON) Value

func (j JSON) Value() (driver.Value, error)

Value returns this instance serialized for database storage.

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 Secret added in v1.10.0

type Secret string

Secret is a string that formats and encodes redacted, as "xxxxx".

Use Value to get the actual secret.

func NewSecret

func NewSecret(s string) *Secret

func (Secret) GoString added in v1.10.0

func (s Secret) GoString() string

func (Secret) MarshalText added in v1.10.0

func (s Secret) MarshalText() ([]byte, error)

func (Secret) String added in v1.10.0

func (s Secret) String() string

type SecretURL added in v1.10.0

type SecretURL URL

SecretURL is a URL that formats and encodes redacted, as "xxxxx".

func MustSecretURL added in v1.10.0

func MustSecretURL(u string) *SecretURL

func NewSecretURL added in v1.10.0

func NewSecretURL(u *URL) *SecretURL

func (*SecretURL) GoString added in v1.10.0

func (s *SecretURL) GoString() string

func (*SecretURL) MarshalText added in v1.10.0

func (s *SecretURL) MarshalText() ([]byte, error)

func (*SecretURL) String added in v1.10.0

func (s *SecretURL) String() string

func (*SecretURL) URL added in v1.10.0

func (s *SecretURL) URL() *url.URL

func (*SecretURL) UnmarshalText added in v1.10.0

func (s *SecretURL) UnmarshalText(text []byte) error

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"`
	AllowHigherAmounts bool           `json:"allowHigherAmounts"`
}

SendEtherRequest represents a request to transfer ETH.

type Sha256Hash added in v0.9.3

type Sha256Hash [32]byte

Explicit type indicating a 32-byte sha256 hash

func MustSha256HashFromHex added in v0.9.3

func MustSha256HashFromHex(x string) Sha256Hash

func Sha256HashFromHex added in v0.9.3

func Sha256HashFromHex(x string) (Sha256Hash, error)

func (Sha256Hash) MarshalJSON added in v0.9.6

func (s Sha256Hash) MarshalJSON() ([]byte, error)

MarshalJSON converts a Sha256Hash to a JSON byte slice.

func (*Sha256Hash) MarshalText added in v1.6.0

func (s *Sha256Hash) MarshalText() ([]byte, error)

func (*Sha256Hash) Scan added in v0.9.3

func (s *Sha256Hash) Scan(value interface{}) error

func (Sha256Hash) String added in v0.9.3

func (s Sha256Hash) String() string

func (*Sha256Hash) UnmarshalJSON added in v0.9.6

func (s *Sha256Hash) UnmarshalJSON(input []byte) error

UnmarshalJSON converts a bytes slice of JSON to a TaskType.

func (*Sha256Hash) UnmarshalText added in v0.9.3

func (s *Sha256Hash) UnmarshalText(bs []byte) (err error)

func (Sha256Hash) Value added in v0.9.3

func (s Sha256Hash) Value() (driver.Value, error)

type URL added in v1.6.0

type URL url.URL

URL extends url.URL to implement encoding.TextMarshaler.

func MustParseURL added in v1.10.0

func MustParseURL(s string) *URL

func ParseURL added in v1.6.0

func ParseURL(s string) (*URL, error)

func (*URL) IsZero added in v1.10.0

func (u *URL) IsZero() bool

func (*URL) MarshalText added in v1.6.0

func (u *URL) MarshalText() ([]byte, error)

func (*URL) String added in v1.10.0

func (u *URL) String() string

func (*URL) URL added in v1.10.0

func (u *URL) URL() *url.URL

URL returns a copy of u as a *url.URL

func (*URL) UnmarshalText added in v1.6.0

func (u *URL) UnmarshalText(input []byte) error

type WebURL

type WebURL url.URL

WebURL contains the URL of the endpoint.

func (WebURL) MarshalJSON

func (w WebURL) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON-encoded string of the given data.

func (*WebURL) Scan

func (w *WebURL) Scan(value interface{}) error

Scan reads the database value and returns an instance.

func (WebURL) String

func (w WebURL) String() string

String delegates to the wrapped URL struct or an empty string when it is nil

func (*WebURL) UnmarshalJSON

func (w *WebURL) UnmarshalJSON(j []byte) error

UnmarshalJSON parses the raw URL stored in JSON-encoded data to a URL structure and sets it to the URL field.

func (WebURL) Value

func (w WebURL) Value() (driver.Value, error)

Value returns this instance serialized for database storage.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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