Documentation ¶
Index ¶
- Constants
- Variables
- func Decode(interf interface{}, v Value) (err error)
- func Generate(r *rand.Rand, size int, allowStruct, allowList bool) reflect.Value
- func GenerateFromKind(r *rand.Rand, size int, kind Kind, allowStruct, allowList bool) reflect.Value
- func MarshalType(t Type, buf []byte, rem int) ([]byte, int, error)
- func SizeHintType(t Type) int
- func UnmarshalType(t *Type, buf []byte, rem int) ([]byte, int, error)
- type Bool
- func (x Bool) Equal(y Bool) bool
- func (Bool) Generate(r *rand.Rand, size int) reflect.Value
- func (x Bool) Marshal(buf []byte, rem int) ([]byte, int, error)
- func (x Bool) MarshalJSON() ([]byte, error)
- func (x Bool) SizeHint() int
- func (x Bool) String() string
- func (x Bool) Type() Type
- func (x *Bool) Unmarshal(buf []byte, rem int) ([]byte, int, error)
- func (x *Bool) UnmarshalJSON(data []byte) error
- type Bytes
- func (x Bytes) Equal(y Bytes) bool
- func (Bytes) Generate(r *rand.Rand, size int) reflect.Value
- func (x Bytes) Marshal(buf []byte, rem int) ([]byte, int, error)
- func (x Bytes) MarshalJSON() ([]byte, error)
- func (x Bytes) MarshalText() ([]byte, error)
- func (x Bytes) SizeHint() int
- func (x Bytes) String() string
- func (Bytes) Type() Type
- func (x *Bytes) Unmarshal(buf []byte, rem int) ([]byte, int, error)
- func (x *Bytes) UnmarshalJSON(data []byte) error
- func (x *Bytes) UnmarshalText(text []byte) error
- type Bytes32
- func (x Bytes32) Bytes() []byte
- func (x Bytes32) Equal(y *Bytes32) bool
- func (Bytes32) Generate(r *rand.Rand, size int) reflect.Value
- func (x Bytes32) Marshal(buf []byte, rem int) ([]byte, int, error)
- func (x Bytes32) MarshalJSON() ([]byte, error)
- func (x Bytes32) MarshalText() ([]byte, error)
- func (x Bytes32) SizeHint() int
- func (x Bytes32) String() string
- func (Bytes32) Type() Type
- func (x *Bytes32) Unmarshal(buf []byte, rem int) ([]byte, int, error)
- func (x *Bytes32) UnmarshalJSON(data []byte) error
- func (x *Bytes32) UnmarshalText(text []byte) error
- type Bytes65
- func (x Bytes65) Bytes() []byte
- func (x Bytes65) Equal(y *Bytes65) bool
- func (Bytes65) Generate(r *rand.Rand, size int) reflect.Value
- func (x Bytes65) Marshal(buf []byte, rem int) ([]byte, int, error)
- func (x Bytes65) MarshalJSON() ([]byte, error)
- func (x Bytes65) MarshalText() ([]byte, error)
- func (x Bytes65) SizeHint() int
- func (x Bytes65) String() string
- func (Bytes65) Type() Type
- func (x *Bytes65) Unmarshal(buf []byte, rem int) ([]byte, int, error)
- func (x *Bytes65) UnmarshalJSON(data []byte) error
- func (x *Bytes65) UnmarshalText(text []byte) error
- type Kind
- func (kind Kind) Generate(r *rand.Rand, size int) reflect.Value
- func (kind Kind) Marshal(buf []byte, rem int) ([]byte, int, error)
- func (kind Kind) MarshalText() ([]byte, error)
- func (kind Kind) SizeHint() int
- func (kind Kind) String() string
- func (kind *Kind) Unmarshal(buf []byte, rem int) ([]byte, int, error)
- func (kind *Kind) UnmarshalText(text []byte) error
- type List
- func (List) Generate(r *rand.Rand, size int) reflect.Value
- func (v List) Marshal(buf []byte, rem int) ([]byte, int, error)
- func (v List) MarshalJSON() ([]byte, error)
- func (v List) SizeHint() int
- func (v List) String() string
- func (v List) Type() Type
- func (v *List) Unmarshal(buf []byte, rem int) ([]byte, int, error)
- type String
- func (x String) Equal(y String) bool
- func (String) Generate(r *rand.Rand, size int) reflect.Value
- func (x String) Marshal(buf []byte, rem int) ([]byte, int, error)
- func (x String) MarshalJSON() ([]byte, error)
- func (x String) SizeHint() int
- func (x String) String() string
- func (String) Type() Type
- func (x *String) Unmarshal(buf []byte, rem int) ([]byte, int, error)
- func (x *String) UnmarshalJSON(data []byte) error
- type Struct
- func (Struct) Generate(r *rand.Rand, size int) reflect.Value
- func (v Struct) Get(name string) Value
- func (v Struct) Marshal(buf []byte, rem int) ([]byte, int, error)
- func (v Struct) MarshalJSON() ([]byte, error)
- func (v *Struct) Set(name string, value Value) Value
- func (v Struct) SizeHint() int
- func (v Struct) String() string
- func (v Struct) Type() Type
- type StructField
- type Type
- type Typed
- func (Typed) Generate(r *rand.Rand, size int) reflect.Value
- func (typed Typed) Get(name string) Value
- func (typed Typed) Marshal(buf []byte, rem int) ([]byte, int, error)
- func (typed Typed) MarshalJSON() ([]byte, error)
- func (typed *Typed) Set(name string, value Value) Value
- func (typed Typed) SizeHint() int
- func (typed Typed) String() string
- func (typed Typed) Type() Type
- func (typed *Typed) Unmarshal(buf []byte, rem int) ([]byte, int, error)
- func (typed *Typed) UnmarshalJSON(data []byte) error
- type U128
- func NewU128(x [16]byte) U128
- func NewU128FromInt(x *big.Int) U128
- func NewU128FromU16(x U16) U128
- func NewU128FromU32(x U32) U128
- func NewU128FromU64(x U64) U128
- func NewU128FromU8(x U8) U128
- func NewU128FromUint16(x uint16) U128
- func NewU128FromUint32(x uint32) U128
- func NewU128FromUint64(x uint64) U128
- func NewU128FromUint8(x uint8) U128
- func (u128 U128) Add(other U128) U128
- func (u128 *U128) AddAssign(other U128)
- func (u128 U128) Bytes() []byte
- func (u128 U128) Bytes16() [16]byte
- func (u128 U128) Div(other U128) U128
- func (u128 U128) Equal(other U128) bool
- func (u128 U128) Generate(r *rand.Rand, size int) reflect.Value
- func (u128 U128) GreaterThan(other U128) bool
- func (u128 U128) GreaterThanEqual(other U128) bool
- func (u128 U128) Int() *big.Int
- func (u128 U128) LessThan(other U128) bool
- func (u128 U128) LessThanEqual(other U128) bool
- func (u128 U128) Marshal(buf []byte, rem int) ([]byte, int, error)
- func (u128 U128) MarshalJSON() ([]byte, error)
- func (u128 U128) Mul(other U128) U128
- func (u128 U128) SizeHint() int
- func (u128 U128) String() string
- func (u128 U128) Sub(other U128) U128
- func (u128 *U128) SubAssign(other U128)
- func (U128) Type() Type
- func (u128 *U128) Unmarshal(buf []byte, rem int) ([]byte, int, error)
- func (u128 *U128) UnmarshalJSON(data []byte) error
- type U16
- func (u16 U16) Add(other U16) U16
- func (u16 *U16) AddAssign(other U16)
- func (u16 U16) Equal(other U16) bool
- func (u16 U16) Generate(r *rand.Rand, size int) reflect.Value
- func (u16 U16) Marshal(buf []byte, rem int) ([]byte, int, error)
- func (u16 U16) MarshalJSON() ([]byte, error)
- func (u16 U16) SizeHint() int
- func (u16 U16) String() string
- func (u16 U16) Sub(other U16) U16
- func (u16 *U16) SubAssign(other U16)
- func (U16) Type() Type
- func (u16 U16) Uint16() uint16
- func (u16 *U16) Unmarshal(buf []byte, rem int) ([]byte, int, error)
- func (u16 *U16) UnmarshalJSON(data []byte) error
- type U256
- func NewU256(x [32]byte) U256
- func NewU256FromInt(x *big.Int) U256
- func NewU256FromU128(x U128) U256
- func NewU256FromU16(x U16) U256
- func NewU256FromU32(x U32) U256
- func NewU256FromU64(x U64) U256
- func NewU256FromU8(x U8) U256
- func NewU256FromUint16(x uint16) U256
- func NewU256FromUint32(x uint32) U256
- func NewU256FromUint64(x uint64) U256
- func NewU256FromUint8(x uint8) U256
- func (u256 U256) Add(other U256) U256
- func (u256 *U256) AddAssign(other U256)
- func (u256 U256) Bytes() []byte
- func (u256 U256) Bytes32() [32]byte
- func (u256 U256) Div(other U256) U256
- func (u256 U256) Equal(other U256) bool
- func (u256 U256) Generate(r *rand.Rand, size int) reflect.Value
- func (u256 U256) GreaterThan(other U256) bool
- func (u256 U256) GreaterThanEqual(other U256) bool
- func (u256 U256) Int() *big.Int
- func (u256 U256) LessThan(other U256) bool
- func (u256 U256) LessThanEqual(other U256) bool
- func (u256 U256) Marshal(buf []byte, rem int) ([]byte, int, error)
- func (u256 U256) MarshalJSON() ([]byte, error)
- func (u256 U256) Mul(other U256) U256
- func (u256 U256) SizeHint() int
- func (u256 U256) String() string
- func (u256 U256) Sub(other U256) U256
- func (u256 *U256) SubAssign(other U256)
- func (U256) Type() Type
- func (u256 *U256) Unmarshal(buf []byte, rem int) ([]byte, int, error)
- func (u256 *U256) UnmarshalJSON(data []byte) error
- type U32
- func (u32 U32) Add(other U32) U32
- func (u32 *U32) AddAssign(other U32)
- func (u32 U32) Equal(other U32) bool
- func (u32 U32) Generate(r *rand.Rand, size int) reflect.Value
- func (u32 U32) Marshal(buf []byte, rem int) ([]byte, int, error)
- func (u32 U32) MarshalJSON() ([]byte, error)
- func (u32 U32) SizeHint() int
- func (u32 U32) String() string
- func (u32 U32) Sub(other U32) U32
- func (u32 *U32) SubAssign(other U32)
- func (U32) Type() Type
- func (u32 U32) Uint32() uint32
- func (u32 *U32) Unmarshal(buf []byte, rem int) ([]byte, int, error)
- func (u32 *U32) UnmarshalJSON(data []byte) error
- type U64
- func (u64 U64) Add(other U64) U64
- func (u64 *U64) AddAssign(other U64)
- func (u64 U64) Equal(other U64) bool
- func (u64 U64) Generate(r *rand.Rand, size int) reflect.Value
- func (u64 U64) Marshal(buf []byte, rem int) ([]byte, int, error)
- func (u64 U64) MarshalJSON() ([]byte, error)
- func (u64 U64) SizeHint() int
- func (u64 U64) String() string
- func (u64 U64) Sub(other U64) U64
- func (u64 *U64) SubAssign(other U64)
- func (U64) Type() Type
- func (u64 U64) Uint64() uint64
- func (u64 *U64) Unmarshal(buf []byte, rem int) ([]byte, int, error)
- func (u64 *U64) UnmarshalJSON(data []byte) error
- type U8
- func (u8 U8) Add(other U8) U8
- func (u8 *U8) AddAssign(other U8)
- func (u8 U8) Equal(other U8) bool
- func (u8 U8) Generate(r *rand.Rand, size int) reflect.Value
- func (u8 U8) Marshal(buf []byte, rem int) ([]byte, int, error)
- func (u8 U8) MarshalJSON() ([]byte, error)
- func (u8 U8) SizeHint() int
- func (u8 U8) String() string
- func (u8 U8) Sub(other U8) U8
- func (u8 *U8) SubAssign(other U8)
- func (U8) Type() Type
- func (u8 U8) Uint8() uint8
- func (u8 *U8) Unmarshal(buf []byte, rem int) ([]byte, int, error)
- func (u8 *U8) UnmarshalJSON(data []byte) error
- type Value
Constants ¶
const ( // KindNil should never be used. KindNil = Kind(0) // KindBool is the kind of all Bool values. KindBool = Kind(1) // KindU8 is the kind of all U8 values. KindU8 = Kind(2) // KindU16 is the kind of all U16 values. KindU16 = Kind(3) // KindU32 is the kind of all U32 values. KindU32 = Kind(4) // KindU64 is the kind of all U64 values. KindU64 = Kind(5) // KindU128 is the kind of all U128 values. KindU128 = Kind(6) // KindU256 is the kind of all U256 values. KindU256 = Kind(7) // KindString is the kind of all utf8 strings. KindString = Kind(10) // KindBytes is the kind of all dynamic byte arrays. KindBytes = Kind(11) // KindBytes32 is the kind of all 32-byte arrays. KindBytes32 = Kind(12) // KindBytes65 is the kind of all 65-byte arrays. KindBytes65 = Kind(13) // KindStruct is the kind of all struct values. It is abstract, because it does // not specify the fields in the struct. KindStruct = Kind(20) // KindList is the kind of all list values. It is abstract, because it does // not specify the type of the elements in the list. KindList = Kind(21) )
Variables ¶
var ( MaxU8 = func() U8 { return U8(255) }() MaxU16 = func() U16 { return U16(65535) }() MaxU32 = func() U32 { return U32(4294967295) }() MaxU64 = func() U64 { return U64(18446744073709551615) }() MaxU128 = func() U128 { x, _ := new(big.Int).SetString("340282366920938463463374607431768211455", 10) return U128{inner: x} }() MaxU256 = func() U256 { x, _ := new(big.Int).SetString("115792089237316195423570985008687907853269984665640564039457584007913129639935", 10) return U256{inner: x} }() )
Maximum values for unsigned integers.
var MaxBytes = 32 * 1024 * 1024
MaxBytes of an object. Defaults to 32 MB.
Functions ¶
func Decode ¶ added in v0.2.0
Decode a Value interface into a Go interface. The Go interface must be a pointer.
func Generate ¶
Generate a random value. This is helpful when implementing generators for other types. See https://golang.org/pkg/testing/quick/#Generator for more information.
func GenerateFromKind ¶ added in v0.2.6
GenerateFromKind generates a random value given a Kind.
func MarshalType ¶
MarshalType to binary.
func SizeHintType ¶
SizeHintType returns the number of bytes requires to represent this type in binary.
Types ¶
type Bool ¶
type Bool bool
Bool represents a value that can be true or false.
func (Bool) Generate ¶
Generate a random boolean. This method is implemented for use in quick tests. See https://golang.org/pkg/testing/quick/#Generator for more information.
func (Bool) MarshalJSON ¶
MarshalJSON marshals the boolean to JSON. This is done using the default JSON marshaler for raw booleans.
func (Bool) SizeHint ¶
SizeHint returns the number of bytes required to represent the boolean in binary.
func (*Bool) UnmarshalJSON ¶
UnmarshalJSON unmarshals the boolean from JSON. This is done using the default JSON unmarshaler for raw booleans.
type Bytes ¶
type Bytes []byte
Bytes represents a slice of bytes with a dynamic length.
func (Bytes) Generate ¶
Generate a random byte slice. This method is implemented for use in quick tests. See https://golang.org/pkg/testing/quick/#Generator for more information.
func (Bytes) MarshalJSON ¶
MarshalJSON marshals the bytes to JSON. This is done by encoding the bytes into a base64 raw URL encoded string.
func (Bytes) MarshalText ¶ added in v0.2.3
MarshalText marshals the bytes to text. This is done by encoding the bytes into a base64 raw URL encoded string.
func (Bytes) SizeHint ¶
SizeHint returns the number of bytes required to represent the bytes in binary. This includes the length prefix that encodes the dynamic length of the bytes.
func (*Bytes) UnmarshalJSON ¶
UnmarshalJSON unmarshals the bytes from JSON. This is done by decoding the bytes from a base64 raw URL encoded string.
func (*Bytes) UnmarshalText ¶ added in v0.2.3
UnmarshalText unmarshals the bytes from text. This is done by decoding the bytes from a base64 raw URL encoded string.
type Bytes32 ¶
type Bytes32 [32]byte
Bytes32 represents a static-sized 32-byte array.
func NewBytes32 ¶
NewBytes32 wraps an existing raw 32-byte array.
func (Bytes32) Generate ¶
Generate a random 32-byte array. This method is implemented for use in quick tests. See https://golang.org/pkg/testing/quick/#Generator for more information.
func (Bytes32) MarshalJSON ¶
MarshalJSON marshals the 32-byte array to JSON. This is done by encoding the bytes into a base64 raw URL encoded string.
func (Bytes32) MarshalText ¶ added in v0.2.3
MarshalText marshals the 32-byte array to text. This is done by encoding the bytes into a base64 raw URL encoded string.
func (Bytes32) SizeHint ¶
SizeHint returns the number of bytes required to represent the 32-byte array in binary.
func (*Bytes32) UnmarshalJSON ¶
UnmarshalJSON unmarshals the 32-byte array from JSON. This is done by decoding the bytes from a base64 raw URL encoded string.
func (*Bytes32) UnmarshalText ¶ added in v0.2.3
UnmarshalText unmarshals the 32-byte array from text. This is done by decoding the bytes from a base64 raw URL encoded string.
type Bytes65 ¶
type Bytes65 [65]byte
Bytes65 represents a static-sized 65-byte array.
func NewBytes65 ¶
NewBytes65 wraps an existing raw 65-byte array.
func (Bytes65) Generate ¶
Generate a random 65-byte array. This method is implemented for use in quick tests. See https://golang.org/pkg/testing/quick/#Generator for more information.
func (Bytes65) MarshalJSON ¶
MarshalJSON marshals the 65-byte array to JSON. This is done by encoding the bytes into a base64 raw URL encoded string.
func (Bytes65) MarshalText ¶ added in v0.2.3
MarshalText marshals the 65-byte array to text. This is done by encoding the bytes into a base64 raw URL encoded string.
func (Bytes65) SizeHint ¶
SizeHint returns the number of bytes required to represent the 65-byte array in binary.
func (*Bytes65) UnmarshalJSON ¶
UnmarshalJSON unmarshals the 65-byte array from JSON. This is done by decoding the bytes from a base64 raw URL encoded string.
func (*Bytes65) UnmarshalText ¶ added in v0.2.3
UnmarshalText unmarshals the 65-byte array from text. This is done by decoding the bytes from a base64 raw URL encoded string.
type Kind ¶
type Kind uint8
A Kind is an optionally abstract type identifier. It can be thought of as the "type of a type", or the "constructor for a type". For example, a struct is an abstract type identifier, because it does not bind the respective value to have any specific fields (or types for those fields). Similarly, a list is an abstract type identifier, because it does not bind the respective value to a specific type of element.
func (Kind) Generate ¶
Generate a random kind. This method is implemented for use in quick tests. See https://golang.org/pkg/testing/quick/#Generator for more information.
func (Kind) MarshalText ¶
MarshalText from the kind. Unrecognised kinds will be marshaled into the "nil" string.
func (Kind) SizeHint ¶
SizeHint returns the number of bytes required to represent the kind in binary.
func (*Kind) UnmarshalText ¶
UnmarshalText into the kind. Unrecognised text will be unmarshaled into the KindNil, and will be considered invalid.
type List ¶ added in v0.2.6
func (List) Generate ¶ added in v0.2.6
Generate a random list. This method is implemented for use in quick tests. See https://golang.org/pkg/testing/quick/#Generator for more information. Generated lists will never contain embedded lists.
func (List) MarshalJSON ¶ added in v0.2.6
MarshalJSON marshals the list to JSON.
func (List) SizeHint ¶ added in v0.2.6
SizeHint returns the number of bytes required to represent the list in binary.
type String ¶
type String string
String represents a slice of bytes that should be interpreted as a UTF-8 encoded string.
func (String) Generate ¶
Generate a random string. This method is implemented for use in quick tests. See https://golang.org/pkg/testing/quick/#Generator for more information.
func (String) MarshalJSON ¶
MarshalJSON marshals the string to JSON. This is done using the default JSON marshaler for raw strings.
func (String) SizeHint ¶
SizeHint returns the number of bytes required to represent the string in binary.
func (String) String ¶
String returns the raw string. This method exists to implement the Stringer interface.
func (*String) UnmarshalJSON ¶
UnmarshalJSON unmarshals the string from JSON. This is done using the default JSON unmarshaler for raw strings.
type Struct ¶
type Struct []StructField
Struct represents a structured record.
func NewStruct ¶
func NewStruct(vs ...interface{}) Struct
NewStruct returns a new struct from a slice of variadic arguments. The arguments are expected to be of the form ("name", value)* otherwise the function will panic. The same field name must not be used more than once.
x := NewStruct( "foo", NewU64(42), "bar", NewString("pack is awesome"), "baz", NewBool(true), )
func (Struct) Generate ¶
Generate a random struct field. This method is implemented for use in quick tests. See https://golang.org/pkg/testing/quick/#Generator for more information. Generated structs will never contain embedded structs.
func (Struct) Get ¶
Get a field value from the struct, given the field name. This method has O(n) complexity, where N is the number of fields in the struct.
func (Struct) MarshalJSON ¶
MarshalJSON marshals the struct to JSON. This is done by marshaling the struct as if it was a JSON object, where each field in the struct is a field in the JSON object with the same name.
func (*Struct) Set ¶
Set a field value in the struct, given the field name. This method has O(n) complexity, where N is the number of fields in the struct.
func (Struct) SizeHint ¶
SizeHint returns the number of bytes required to represent the struct in binary.
type StructField ¶
StructField represents a named field within a struct. It is not, by itself, a value or a type. It is only meant to be used to build structs.
func NewStructField ¶
func NewStructField(name string, value Value) StructField
NewStructField returns a struct field with the given name and value.
func (StructField) Generate ¶
Generate a random struct field. This method is implemented for use in quick tests. See https://golang.org/pkg/testing/quick/#Generator for more information. Generated struct fields will never have structs as values.
func (StructField) SizeHint ¶
func (x StructField) SizeHint() int
SizeHint returns the number of bytes required to represent the struct field in binary.
type Type ¶
type Type interface { surge.Marshaler json.Marshaler // Kind returns the abstract "type of the type" for this type. Kind() Kind // Equals returns a boolean indicating whether or not the given type is // identical to the current one. Equals(other Type) bool // Unmarshal a value of this type from binary. UnmarshalValue(buf []byte, rem int) (Value, []byte, int, error) // Unmarshal a value of this type from JSON. UnmarshalValueJSON(data []byte) (Value, error) }
A Type is a concrete type definition for a value.
type Typed ¶
type Typed Struct
A Typed struct is a wrapper around a struct. It includes a type definition when marshaled to binary or JSON. This type definition allows for well-typed unmarshaling over-the-wire. This is particularly useful when sending well-typed values over a network, or when saving them to the disk.
func NewTyped ¶
func NewTyped(vs ...interface{}) Typed
NewTyped returns a well-typed struct from a slice of variadic arguments. The arguments are expected to be of the form ("name", value)* otherwise the function will panic.
x := NewTyped( "foo", NewU64(42), "bar", NewString("pack is awesome"), "baz", NewBool(true), )
func (Typed) Generate ¶
Generate a random well-typed struct. This method is implemented for use in quick tests. See https://golang.org/pkg/testing/quick/#Generator for more information. Generated typed values will never contain embedded structs.
func (Typed) Get ¶ added in v0.1.1
Get a field value from the struct, given the field name. This method has O(n) complexity, where N is the number of fields in the struct.
func (Typed) Marshal ¶
Marshal the typed value into binary. The type definition for the typed values will be marshaled first, and then the actual value will be marshaled.
func (Typed) MarshalJSON ¶
MarshalJSON marshals the typed value into JSON. It will marshal an object with fields "t" and "v". The "t" field defines the type of the "v" field. The "v" field is the JSON marshaling of the value.
func (*Typed) Set ¶ added in v0.1.1
Set a field value in the struct, given the field name. This method has O(n) complexity, where N is the number of fields in the struct.
func (Typed) SizeHint ¶
SizeHint returns the number of bytes required to represent the typed value in binary.
func (Typed) Type ¶
Type returns the inner structured record type. This method has O(n) complexity, where N is the number of fields in the well-typed struct.
func (*Typed) Unmarshal ¶
Unmarshal the typed value from binary. The type definition will be unmarshaled first, and then this will be used to unmarshal the actual value into a well-typed struct.
func (*Typed) UnmarshalJSON ¶
UnmarshalJSON unmarshals the typed value from JSON. It will unmarshal the object and expect two fields: "t" and "v". It will use the "t" field to understand the type of "v". It will then use this understanding to unmarshal "v" into a well-typed struct.
type U128 ¶
type U128 struct {
// contains filtered or unexported fields
}
func NewU128FromInt ¶
func NewU128FromU16 ¶
func NewU128FromU32 ¶
func NewU128FromU64 ¶
func NewU128FromU8 ¶
func NewU128FromUint16 ¶ added in v0.2.4
func NewU128FromUint32 ¶ added in v0.2.4
func NewU128FromUint64 ¶ added in v0.2.4
func NewU128FromUint8 ¶ added in v0.2.4
func (U128) Generate ¶
Generate a random int. This method is implemented for use in quick tests. See https://golang.org/pkg/testing/quick/#Generator for more information.
func (U128) GreaterThan ¶ added in v0.2.5
func (U128) GreaterThanEqual ¶ added in v0.2.5
func (U128) LessThanEqual ¶ added in v0.2.5
func (U128) MarshalJSON ¶
func (*U128) UnmarshalJSON ¶
type U16 ¶
type U16 uint16
U16 represents a 16-bit unsigned integer.
func (*U16) AddAssign ¶
AddAssign will add one U16 to another and assign the result to the left-hand side.
func (U16) Equal ¶
Equal compares one U16 to another. If they are equal, then it returns true. Otherwise, it returns false.
func (U16) Generate ¶
Generate a random int. This method is implemented for use in quick tests. See https://golang.org/pkg/testing/quick/#Generator for more information.
func (U16) MarshalJSON ¶
MarshalJSON implements the JSON marshaler interface. U16s are marshaled as decimal strings (for consistency with larger integer types).
func (*U16) SubAssign ¶
SubAssign will sub one U16 from another and assign the result to the left-hand side.
func (*U16) UnmarshalJSON ¶
UnmarshalJSON implements the JSON unmarshaler interface. U16s are unmarshaled as decimal strings (for consistency with larger integer types).
type U256 ¶
type U256 struct {
// contains filtered or unexported fields
}
func NewU256FromInt ¶
func NewU256FromU128 ¶
func NewU256FromU16 ¶
func NewU256FromU32 ¶
func NewU256FromU64 ¶
func NewU256FromU8 ¶
func NewU256FromUint16 ¶ added in v0.2.4
func NewU256FromUint32 ¶ added in v0.2.4
func NewU256FromUint64 ¶ added in v0.2.4
func NewU256FromUint8 ¶ added in v0.2.4
func (U256) Generate ¶
Generate a random int. This method is implemented for use in quick tests. See https://golang.org/pkg/testing/quick/#Generator for more information.
func (U256) GreaterThan ¶ added in v0.2.5
func (U256) GreaterThanEqual ¶ added in v0.2.5
func (U256) LessThanEqual ¶ added in v0.2.5
func (U256) MarshalJSON ¶
func (*U256) UnmarshalJSON ¶
type U32 ¶
type U32 uint32
U32 represents a 32-bit unsigned integer.
func (*U32) AddAssign ¶
AddAssign will add one U32 to another and assign the result to the left-hand side.
func (U32) Equal ¶
Equal compares one U32 to another. If they are equal, then it returns true. Otherwise, it returns false.
func (U32) Generate ¶
Generate a random int. This method is implemented for use in quick tests. See https://golang.org/pkg/testing/quick/#Generator for more information.
func (U32) MarshalJSON ¶
MarshalJSON implements the JSON marshaler interface. U32s are marshaled as decimal strings (for consistency with larger integer types).
func (*U32) SubAssign ¶
SubAssign will sub one U32 from another and assign the result to the left-hand side.
func (*U32) UnmarshalJSON ¶
UnmarshalJSON implements the JSON unmarshaler interface. U32s are unmarshaled as decimal strings (for consistency with larger integer types).
type U64 ¶
type U64 uint64
U64 represents a 64-bit unsigned integer.
func (*U64) AddAssign ¶
AddAssign will add one U64 to another and assign the result to the left-hand side.
func (U64) Equal ¶
Equal compares one U64 to another. If they are equal, then it returns true. Otherwise, it returns false.
func (U64) Generate ¶
Generate a random int. This method is implemented for use in quick tests. See https://golang.org/pkg/testing/quick/#Generator for more information.
func (U64) MarshalJSON ¶
MarshalJSON implements the JSON marshaler interface. U64s are marshaled as decimal strings (for consistency with larger integer types).
func (*U64) SubAssign ¶
SubAssign will sub one U64 from another and assign the result to the left-hand side.
func (*U64) UnmarshalJSON ¶
UnmarshalJSON implements the JSON unmarshaler interface. U64s are unmarshaled as decimal strings (for consistency with larger integer types).
type U8 ¶
type U8 uint8
U8 represents an 8-bit unsigned integer.
func (*U8) AddAssign ¶
AddAssign will add one U8 to another and assign the result to the left-hand side.
func (U8) Equal ¶
Equal compares one U8 to another. If they are equal, then it returns true. Otherwise, it returns false.
func (U8) Generate ¶
Generate a random int. This method is implemented for use in quick tests. See https://golang.org/pkg/testing/quick/#Generator for more information.
func (U8) MarshalJSON ¶
MarshalJSON implements the JSON marshaler interface. U8s are marshaled as decimal strings (for consistency with larger integer types).
func (*U8) SubAssign ¶
SubAssign will sub one U8 from another and assign the result to the left-hand side.
func (*U8) UnmarshalJSON ¶
UnmarshalJSON implements the JSON unmarshaler interface. U8s are unmarshaled as decimal strings (for consistency with larger integer types).