Documentation ¶
Index ¶
- Variables
- func IsValidNumberString(s string) bool
- func ParseNumberString(s string, base int) (int64, bool)
- type BigInt
- func NewBigInt(n int64) BigInt
- func NewBigIntFromHexString(hs string) BigInt
- func NewBigIntFromNumberString(hs string) BigInt
- func NewBigIntFromString(s string, base int) BigInt
- func ToBigInt(b *big.Int) BigInt
- func ToBigIntArray(bs []*big.Int) []BigInt
- func ToBigIntArrayFromStringArray(s []string, base int) ([]BigInt, error)
- func ToBigIntFromInt64(n int64) BigInt
- func (b *BigInt) Add(n *big.Int)
- func (b BigInt) Equals(n *big.Int) bool
- func (b *BigInt) ExtensionType() int8
- func (b BigInt) Gt(n *big.Int) bool
- func (b BigInt) Gte(n *big.Int) bool
- func (b BigInt) Int() *big.Int
- func (b BigInt) Int64() int64
- func (b *BigInt) Len() int
- func (b BigInt) Lt(n *big.Int) bool
- func (b BigInt) Lte(n *big.Int) bool
- func (b *BigInt) MarshalBinary() (data []byte, err error)
- func (b *BigInt) MarshalBinaryTo(buff []byte) error
- func (b BigInt) MarshalJSON() ([]byte, error)
- func (b BigInt) MarshalText() ([]byte, error)
- func (b *BigInt) Scan(src interface{}) error
- func (b *BigInt) SetString(s string, base int) bool
- func (b BigInt) String() string
- func (b *BigInt) Sub(n *big.Int)
- func (b BigInt) Uint64() uint64
- func (b *BigInt) UnmarshalBinary(buff []byte) error
- func (b *BigInt) UnmarshalJSON(text []byte) error
- func (b *BigInt) UnmarshalText(text []byte) error
- func (b BigInt) Value() (driver.Value, error)
- type Hash
- func (h Hash) Bytes() []byte
- func (h *Hash) ExtensionType() int8
- func (h *Hash) Hash() common.Hash
- func (h Hash) IsValidAddress() bool
- func (h Hash) IsValidTxnHash() bool
- func (h Hash) IsZeroValue() bool
- func (h *Hash) Len() int
- func (h *Hash) MarshalBinaryTo(b []byte) error
- func (h *Hash) MarshalText() ([]byte, error)
- func (h *Hash) Scan(src interface{}) error
- func (h Hash) String() string
- func (h Hash) ToAddress() common.Address
- func (h Hash) ToHash() common.Hash
- func (h Hash) ToShortHash() Hash
- func (h *Hash) UnmarshalBinary(b []byte) error
- func (h *Hash) UnmarshalText(src []byte) error
- func (h Hash) Value() (driver.Value, error)
- type HashMaybe
- func (h *HashMaybe) ExtensionType() int8
- func (h *HashMaybe) Len() int
- func (h *HashMaybe) MarshalBinaryTo(b []byte) error
- func (h HashMaybe) MarshalText() ([]byte, error)
- func (h *HashMaybe) Scan(src interface{}) error
- func (h *HashMaybe) SetNil()
- func (h *HashMaybe) SetValue(hash Hash)
- func (h *HashMaybe) UnmarshalBinary(b []byte) error
- func (h *HashMaybe) UnmarshalText(src []byte) error
- func (h HashMaybe) Value() (driver.Value, error)
- type Hexer
- type JSONString
- type Key
- func (k Key) Bytes() []byte
- func (k *Key) ExtensionType() int8
- func (k Key) IsValid() bool
- func (k Key) IsZeroValue() bool
- func (k *Key) Len() int
- func (k *Key) MarshalBinaryTo(b []byte) error
- func (k *Key) Scan(src interface{}) error
- func (k Key) String() string
- func (k *Key) UnmarshalBinary(b []byte) error
- func (k Key) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
var ( EmptyKey = [16]byte{} EmptyKeySlice = EmptyKey[:] )
Functions ¶
func IsValidNumberString ¶ added in v0.16.0
Types ¶
type BigInt ¶
BigInt is a type alias for big.Int used for JSON/Database marshalling.
For JSON values we encoded BigInt's as strings.
For Database values we encoded BigInt's as NUMERIC(78).
func NewBigIntFromHexString ¶ added in v0.16.0
func NewBigIntFromNumberString ¶ added in v0.16.0
func NewBigIntFromString ¶ added in v0.4.1
func ToBigIntArray ¶
func ToBigIntFromInt64 ¶
func (*BigInt) ExtensionType ¶ added in v0.12.4
func (*BigInt) MarshalBinary ¶ added in v0.14.1
func (*BigInt) MarshalBinaryTo ¶ added in v0.12.4
func (BigInt) MarshalJSON ¶
MarshalJSON implements json.Marshaler
func (BigInt) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*BigInt) UnmarshalBinary ¶ added in v0.12.4
func (*BigInt) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler
func (*BigInt) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type Hash ¶
type Hash string
Hash is a type alias for common.Hash used for data normalization with JSON/Database marshalling.
NOTE: when used with a db like postgres, the column type must be a `bytea`
func HashFromBytes ¶ added in v0.4.25
func HashFromString ¶
func (*Hash) ExtensionType ¶ added in v0.12.4
func (Hash) IsValidAddress ¶
func (Hash) IsValidTxnHash ¶
func (Hash) IsZeroValue ¶
func (*Hash) MarshalBinaryTo ¶ added in v0.12.4
func (*Hash) MarshalText ¶
UnmarshalText implements encoding.TextMarshaler.
func (Hash) ToShortHash ¶ added in v0.19.2
func (*Hash) UnmarshalBinary ¶ added in v0.12.4
func (*Hash) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type HashMaybe ¶ added in v0.4.23
type HashMaybe struct { Hash // IsAssigned=false means value is nil. IsAssigned=true means value in .Hash is the value. IsAssigned bool }
HashMaybe is a nullable Hash value useful for database fields which accept NULL type.
func BytesToHashMaybe ¶ added in v0.4.23
func HashMaybeFromString ¶ added in v0.4.23
func ToHashMaybe ¶ added in v0.4.23
func (*HashMaybe) ExtensionType ¶ added in v0.12.4
func (*HashMaybe) MarshalBinaryTo ¶ added in v0.12.4
func (HashMaybe) MarshalText ¶ added in v0.4.23
UnmarshalText implements encoding.TextMarshaler.
func (*HashMaybe) UnmarshalBinary ¶ added in v0.12.4
func (*HashMaybe) UnmarshalText ¶ added in v0.4.23
UnmarshalText implements encoding.TextUnmarshaler.
type JSONString ¶ added in v0.5.8
type JSONString struct {
// contains filtered or unexported fields
}
JSONString is a custom database type that gets serialized into a text value.
func NewJSONString ¶ added in v0.5.8
func NewJSONString(v interface{}) *JSONString
func (JSONString) Data ¶ added in v0.5.8
func (s JSONString) Data() interface{}
func (JSONString) MarshalJSON ¶ added in v0.5.8
func (s JSONString) MarshalJSON() ([]byte, error)
func (*JSONString) Scan ¶ added in v0.5.8
func (s *JSONString) Scan(in interface{}) error
func (*JSONString) UnmarshalJSON ¶ added in v0.5.8
func (s *JSONString) UnmarshalJSON(buf []byte) error
type Key ¶ added in v0.4.23
type Key [16]byte