Documentation
      ¶
    
    
  
    
  
    Index ¶
- Variables
 - func HexBytesToString(b []byte) string
 - func HexStringToBytes(s string) []byte
 - func IsValidNumberString(s string) bool
 - func ParseNumberString(s string, base int) (int64, bool)
 - type BigInt
 - func NewBigInt(n int64) BigInt
 - func NewBigIntFromBinaryString(hs string) BigInt
 - func NewBigIntFromDecimalString(hs string) BigInt
 - func NewBigIntFromHexString(hs string) BigInt
 - func NewBigIntFromNumberString(hs string) BigInt
 - func NewBigIntFromOctalString(hs string) BigInt
 - func NewBigIntFromString(s string, base int) BigInt
 - func ParseBigIntString(s string, base int) (BigInt, bool)
 - 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) Bytes() []byte
 - func (b BigInt) Cmp(n *big.Int) int
 - func (b BigInt) Equals(n *big.Int) bool
 - 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) Lt(n *big.Int) bool
 - func (b BigInt) Lte(n *big.Int) bool
 - func (b BigInt) MarshalBinary() ([]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) ByteSize() int
 - func (h Hash) Bytes() []byte
 - func (h *Hash) Hash() common.Hash
 - func (h Hash) Hex() string
 - func (h Hash) IsValidAddress() bool
 - func (h Hash) IsValidHex() bool
 - func (h Hash) IsValidTxnHash() bool
 - func (h Hash) IsZeroValue() bool
 - func (h Hash) Len() int
 - func (h Hash) MarshalBinary() ([]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) ByteSize() int
 - func (h HashMaybe) Len() int
 - func (h HashMaybe) MarshalBinary() ([]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) ByteSize() int
 - func (k Key) Bytes() []byte
 - func (k Key) IsValid() bool
 - func (k Key) IsZeroValue() bool
 - func (k *Key) Len() int
 - func (k Key) MarshalBinary() ([]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 HexBytesToString ¶ added in v0.50.4
func HexStringToBytes ¶ added in v0.50.4
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 encode BigInt's as strings.
For Database values we encode BigInt's as NUMERIC(78).
func NewBigIntFromBinaryString ¶ added in v0.40.4
func NewBigIntFromDecimalString ¶ added in v0.40.4
func NewBigIntFromHexString ¶ added in v0.16.0
func NewBigIntFromNumberString ¶ added in v0.16.0
Decimal number string
func NewBigIntFromOctalString ¶ added in v0.40.4
func NewBigIntFromString ¶ added in v0.4.1
func ToBigIntArray ¶
func ToBigIntFromInt64 ¶
func (BigInt) MarshalBinary ¶ added in v0.14.1
MarshalBinary implements encoding.BinaryMarshaler. The first byte is the sign byte to represent positive or negative numbers.
func (BigInt) MarshalJSON ¶
MarshalJSON implements json.Marshaler
func (BigInt) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*BigInt) UnmarshalBinary ¶ added in v0.12.4
UnmarshalBinary implements encoding.BinaryUnmarshaler. The first byte is the sign byte to represent positive or negative numbers.
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. Hash is expected to be a hex string.
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 ToHashList ¶ added in v0.25.2
func (Hash) IsValidAddress ¶
func (Hash) IsValidHex ¶ added in v0.50.4
func (Hash) IsValidTxnHash ¶
func (Hash) IsZeroValue ¶
func (Hash) MarshalBinary ¶ added in v0.50.4
MarshalBinary implements encoding.BinaryMarshaler.
func (Hash) MarshalText ¶
UnmarshalText implements encoding.TextMarshaler.
func (Hash) ToShortHash ¶ added in v0.19.2
func (*Hash) UnmarshalBinary ¶ added in v0.12.4
UnmarshalBinary implements encoding.BinaryUnmarshaler.
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) MarshalBinary ¶ added in v0.50.4
MarshalBinary implements encoding.BinaryMarshaler.
func (HashMaybe) MarshalText ¶ added in v0.4.23
UnmarshalText implements encoding.TextMarshaler.
func (*HashMaybe) UnmarshalBinary ¶ added in v0.12.4
UnmarshalBinary implements encoding.BinaryUnmarshaler.
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
func (Key) IsZeroValue ¶ added in v0.4.23
func (Key) MarshalBinary ¶ added in v0.50.4
MarshalBinary implements encoding.BinaryMarshaler.
func (*Key) UnmarshalBinary ¶ added in v0.12.4
UnmarshalBinary implements encoding.BinaryUnmarshaler.