prototyp

package
v0.43.3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 9 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmptyKey      = [16]byte{}
	EmptyKeySlice = EmptyKey[:]
)

Functions

func IsValidNumberString added in v0.16.0

func IsValidNumberString(s string) bool

func ParseNumberString added in v0.16.0

func ParseNumberString(s string, base int) (int64, bool)

Types

type BigInt

type BigInt big.Int

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 NewBigInt

func NewBigInt(n int64) BigInt

func NewBigIntFromBinaryString added in v0.40.4

func NewBigIntFromBinaryString(hs string) BigInt

func NewBigIntFromDecimalString added in v0.40.4

func NewBigIntFromDecimalString(hs string) BigInt

func NewBigIntFromHexString added in v0.16.0

func NewBigIntFromHexString(hs string) BigInt

func NewBigIntFromNumberString added in v0.16.0

func NewBigIntFromNumberString(hs string) BigInt

Decimal number string

func NewBigIntFromOctalString added in v0.40.4

func NewBigIntFromOctalString(hs string) BigInt

func NewBigIntFromString added in v0.4.1

func NewBigIntFromString(s string, base int) BigInt

func ToBigInt

func ToBigInt(b *big.Int) BigInt

func ToBigIntArray

func ToBigIntArray(bs []*big.Int) []BigInt

func ToBigIntArrayFromStringArray

func ToBigIntArrayFromStringArray(s []string, base int) ([]BigInt, error)

func ToBigIntFromInt64

func ToBigIntFromInt64(n int64) BigInt

func (*BigInt) Add

func (b *BigInt) Add(n *big.Int)

func (BigInt) Equals

func (b BigInt) Equals(n *big.Int) bool

func (*BigInt) ExtensionType added in v0.12.4

func (b *BigInt) ExtensionType() int8

func (BigInt) Gt

func (b BigInt) Gt(n *big.Int) bool

func (BigInt) Gte

func (b BigInt) Gte(n *big.Int) bool

func (BigInt) Int

func (b BigInt) Int() *big.Int

func (BigInt) Int64

func (b BigInt) Int64() int64

func (*BigInt) Len added in v0.12.4

func (b *BigInt) Len() int

func (BigInt) Lt

func (b BigInt) Lt(n *big.Int) bool

func (BigInt) Lte

func (b BigInt) Lte(n *big.Int) bool

func (*BigInt) MarshalBinary added in v0.14.1

func (b *BigInt) MarshalBinary() (data []byte, err error)

func (*BigInt) MarshalBinaryTo added in v0.12.4

func (b *BigInt) MarshalBinaryTo(buff []byte) error

func (BigInt) MarshalJSON

func (b BigInt) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (BigInt) MarshalText

func (b BigInt) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*BigInt) Scan

func (b *BigInt) Scan(src interface{}) error

func (*BigInt) SetString added in v0.4.1

func (b *BigInt) SetString(s string, base int) bool

func (BigInt) String

func (b BigInt) String() string

func (*BigInt) Sub

func (b *BigInt) Sub(n *big.Int)

func (BigInt) Uint64

func (b BigInt) Uint64() uint64

func (*BigInt) UnmarshalBinary added in v0.12.4

func (b *BigInt) UnmarshalBinary(buff []byte) error

func (*BigInt) UnmarshalJSON

func (b *BigInt) UnmarshalJSON(text []byte) error

UnmarshalJSON implements json.Unmarshaler

func (*BigInt) UnmarshalText

func (b *BigInt) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (BigInt) Value

func (b BigInt) Value() (driver.Value, error)

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 HashFromBytes(src []byte) Hash

func HashFromString

func HashFromString(s string) Hash

func ToHash added in v0.4.23

func ToHash(h Hexer) Hash

func ToHashList added in v0.25.2

func ToHashList[T Hexer](list []T) []Hash

func (Hash) Bytes added in v0.24.1

func (h Hash) Bytes() []byte

func (*Hash) ExtensionType added in v0.12.4

func (h *Hash) ExtensionType() int8

func (*Hash) Hash

func (h *Hash) Hash() common.Hash

func (Hash) IsValidAddress

func (h Hash) IsValidAddress() bool

func (Hash) IsValidTxnHash

func (h Hash) IsValidTxnHash() bool

func (Hash) IsZeroValue

func (h Hash) IsZeroValue() bool

func (*Hash) Len added in v0.12.4

func (h *Hash) Len() int

func (*Hash) MarshalBinaryTo added in v0.12.4

func (h *Hash) MarshalBinaryTo(b []byte) error

func (*Hash) MarshalText

func (h *Hash) MarshalText() ([]byte, error)

UnmarshalText implements encoding.TextMarshaler.

func (*Hash) Scan

func (h *Hash) Scan(src interface{}) error

func (Hash) String

func (h Hash) String() string

func (Hash) ToAddress

func (h Hash) ToAddress() common.Address

func (Hash) ToHash

func (h Hash) ToHash() common.Hash

func (Hash) ToShortHash added in v0.19.2

func (h Hash) ToShortHash() Hash

func (*Hash) UnmarshalBinary added in v0.12.4

func (h *Hash) UnmarshalBinary(b []byte) error

func (*Hash) UnmarshalText

func (h *Hash) UnmarshalText(src []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Hash) Value

func (h Hash) Value() (driver.Value, error)

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 BytesToHashMaybe(src []byte) HashMaybe

func HashMaybeFromString added in v0.4.23

func HashMaybeFromString(s string) HashMaybe

func ToHashMaybe added in v0.4.23

func ToHashMaybe(h Hexer) HashMaybe

func (*HashMaybe) ExtensionType added in v0.12.4

func (h *HashMaybe) ExtensionType() int8

func (*HashMaybe) Len added in v0.12.4

func (h *HashMaybe) Len() int

func (*HashMaybe) MarshalBinaryTo added in v0.12.4

func (h *HashMaybe) MarshalBinaryTo(b []byte) error

func (HashMaybe) MarshalText added in v0.4.23

func (h HashMaybe) MarshalText() ([]byte, error)

UnmarshalText implements encoding.TextMarshaler.

func (*HashMaybe) Scan added in v0.4.23

func (h *HashMaybe) Scan(src interface{}) error

func (*HashMaybe) SetNil added in v0.4.25

func (h *HashMaybe) SetNil()

func (*HashMaybe) SetValue added in v0.4.25

func (h *HashMaybe) SetValue(hash Hash)

func (*HashMaybe) UnmarshalBinary added in v0.12.4

func (h *HashMaybe) UnmarshalBinary(b []byte) error

func (*HashMaybe) UnmarshalText added in v0.4.23

func (h *HashMaybe) UnmarshalText(src []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (HashMaybe) Value added in v0.4.23

func (h HashMaybe) Value() (driver.Value, error)

type Hexer added in v0.4.23

type Hexer interface {
	Hex() string
}

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

func (JSONString) Value added in v0.5.8

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

type Key added in v0.4.23

type Key [16]byte

func (Key) Bytes added in v0.4.23

func (k Key) Bytes() []byte

func (*Key) ExtensionType added in v0.12.4

func (k *Key) ExtensionType() int8

func (Key) IsValid added in v0.4.23

func (k Key) IsValid() bool

func (Key) IsZeroValue added in v0.4.23

func (k Key) IsZeroValue() bool

func (*Key) Len added in v0.12.4

func (k *Key) Len() int

func (*Key) MarshalBinaryTo added in v0.12.4

func (k *Key) MarshalBinaryTo(b []byte) error

func (*Key) Scan added in v0.4.23

func (k *Key) Scan(src interface{}) error

func (Key) String added in v0.4.23

func (k Key) String() string

func (*Key) UnmarshalBinary added in v0.12.4

func (k *Key) UnmarshalBinary(b []byte) error

func (Key) Value added in v0.4.23

func (k Key) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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