prototyp

package
v0.6.9 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2021 License: Apache-2.0 Imports: 8 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

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 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) 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) Lt

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

func (BigInt) Lte

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

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) 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 (*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) 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) 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) 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) 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) 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) 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) 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