Documentation ¶
Overview ¶
Package gtype provides high performance and concurrent-safe basic variable types.
Index ¶
- type Bool
- func (v *Bool) Cas(old, new bool) (swapped bool)
- func (v *Bool) Clone() *Bool
- func (v Bool) MarshalJSON() ([]byte, error)
- func (v *Bool) Set(value bool) (old bool)
- func (v *Bool) String() string
- func (v *Bool) UnmarshalJSON(b []byte) error
- func (v *Bool) UnmarshalValue(value interface{}) error
- func (v *Bool) Val() bool
- type Byte
- func (v *Byte) Add(delta byte) (new byte)
- func (v *Byte) Cas(old, new byte) (swapped bool)
- func (v *Byte) Clone() *Byte
- func (v Byte) MarshalJSON() ([]byte, error)
- func (v *Byte) Set(value byte) (old byte)
- func (v *Byte) String() string
- func (v *Byte) UnmarshalJSON(b []byte) error
- func (v *Byte) UnmarshalValue(value interface{}) error
- func (v *Byte) Val() byte
- type Bytes
- type Float32
- func (v *Float32) Add(delta float32) (new float32)
- func (v *Float32) Cas(old, new float32) (swapped bool)
- func (v *Float32) Clone() *Float32
- func (v Float32) MarshalJSON() ([]byte, error)
- func (v *Float32) Set(value float32) (old float32)
- func (v *Float32) String() string
- func (v *Float32) UnmarshalJSON(b []byte) error
- func (v *Float32) UnmarshalValue(value interface{}) error
- func (v *Float32) Val() float32
- type Float64
- func (v *Float64) Add(delta float64) (new float64)
- func (v *Float64) Cas(old, new float64) (swapped bool)
- func (v *Float64) Clone() *Float64
- func (v Float64) MarshalJSON() ([]byte, error)
- func (v *Float64) Set(value float64) (old float64)
- func (v *Float64) String() string
- func (v *Float64) UnmarshalJSON(b []byte) error
- func (v *Float64) UnmarshalValue(value interface{}) error
- func (v *Float64) Val() float64
- type Int
- func (v *Int) Add(delta int) (new int)
- func (v *Int) Cas(old, new int) (swapped bool)
- func (v *Int) Clone() *Int
- func (v Int) MarshalJSON() ([]byte, error)
- func (v *Int) Set(value int) (old int)
- func (v *Int) String() string
- func (v *Int) UnmarshalJSON(b []byte) error
- func (v *Int) UnmarshalValue(value interface{}) error
- func (v *Int) Val() int
- type Int32
- func (v *Int32) Add(delta int32) (new int32)
- func (v *Int32) Cas(old, new int32) (swapped bool)
- func (v *Int32) Clone() *Int32
- func (v Int32) MarshalJSON() ([]byte, error)
- func (v *Int32) Set(value int32) (old int32)
- func (v *Int32) String() string
- func (v *Int32) UnmarshalJSON(b []byte) error
- func (v *Int32) UnmarshalValue(value interface{}) error
- func (v *Int32) Val() int32
- type Int64
- func (v *Int64) Add(delta int64) (new int64)
- func (v *Int64) Cas(old, new int64) (swapped bool)
- func (v *Int64) Clone() *Int64
- func (v Int64) MarshalJSON() ([]byte, error)
- func (v *Int64) Set(value int64) (old int64)
- func (v *Int64) String() string
- func (v *Int64) UnmarshalJSON(b []byte) error
- func (v *Int64) UnmarshalValue(value interface{}) error
- func (v *Int64) Val() int64
- type Interface
- func (v *Interface) Clone() *Interface
- func (v Interface) MarshalJSON() ([]byte, error)
- func (v *Interface) Set(value interface{}) (old interface{})
- func (v *Interface) String() string
- func (v *Interface) UnmarshalJSON(b []byte) error
- func (v *Interface) UnmarshalValue(value interface{}) error
- func (v *Interface) Val() interface{}
- type String
- type Uint
- func (v *Uint) Add(delta uint) (new uint)
- func (v *Uint) Cas(old, new uint) (swapped bool)
- func (v *Uint) Clone() *Uint
- func (v Uint) MarshalJSON() ([]byte, error)
- func (v *Uint) Set(value uint) (old uint)
- func (v *Uint) String() string
- func (v *Uint) UnmarshalJSON(b []byte) error
- func (v *Uint) UnmarshalValue(value interface{}) error
- func (v *Uint) Val() uint
- type Uint32
- func (v *Uint32) Add(delta uint32) (new uint32)
- func (v *Uint32) Cas(old, new uint32) (swapped bool)
- func (v *Uint32) Clone() *Uint32
- func (v Uint32) MarshalJSON() ([]byte, error)
- func (v *Uint32) Set(value uint32) (old uint32)
- func (v *Uint32) String() string
- func (v *Uint32) UnmarshalJSON(b []byte) error
- func (v *Uint32) UnmarshalValue(value interface{}) error
- func (v *Uint32) Val() uint32
- type Uint64
- func (v *Uint64) Add(delta uint64) (new uint64)
- func (v *Uint64) Cas(old, new uint64) (swapped bool)
- func (v *Uint64) Clone() *Uint64
- func (v Uint64) MarshalJSON() ([]byte, error)
- func (v *Uint64) Set(value uint64) (old uint64)
- func (v *Uint64) String() string
- func (v *Uint64) UnmarshalJSON(b []byte) error
- func (v *Uint64) UnmarshalValue(value interface{}) error
- func (v *Uint64) Val() uint64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
Bool is a struct for concurrent-safe operation for type bool.
func NewBool ¶
NewBool creates and returns a concurrent-safe object for bool type, with given initial value `value`.
func (Bool) MarshalJSON ¶
MarshalJSON implements the interface MarshalJSON for json.Marshal.
func (*Bool) Set ¶
Set atomically stores `value` into t.value and returns the previous value of t.value.
func (*Bool) UnmarshalJSON ¶
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
func (*Bool) UnmarshalValue ¶
UnmarshalValue is an interface implement which sets any type of value for `v`.
type Byte ¶
type Byte struct {
// contains filtered or unexported fields
}
Byte is a struct for concurrent-safe operation for type byte.
func NewByte ¶
NewByte creates and returns a concurrent-safe object for byte type, with given initial value `value`.
func (Byte) MarshalJSON ¶
MarshalJSON implements the interface MarshalJSON for json.Marshal.
func (*Byte) Set ¶
Set atomically stores `value` into t.value and returns the previous value of t.value.
func (*Byte) UnmarshalJSON ¶
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
func (*Byte) UnmarshalValue ¶
UnmarshalValue is an interface implement which sets any type of value for `v`.
type Bytes ¶
type Bytes struct {
// contains filtered or unexported fields
}
Bytes is a struct for concurrent-safe operation for type []byte.
func NewBytes ¶
NewBytes creates and returns a concurrent-safe object for []byte type, with given initial value `value`.
func (Bytes) MarshalJSON ¶
MarshalJSON implements the interface MarshalJSON for json.Marshal.
func (*Bytes) Set ¶
Set atomically stores `value` into t.value and returns the previous value of t.value. Note: The parameter `value` cannot be nil.
func (*Bytes) UnmarshalJSON ¶
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
func (*Bytes) UnmarshalValue ¶
UnmarshalValue is an interface implement which sets any type of value for `v`.
type Float32 ¶
type Float32 struct {
// contains filtered or unexported fields
}
Float32 is a struct for concurrent-safe operation for type float32.
func NewFloat32 ¶
NewFloat32 creates and returns a concurrent-safe object for float32 type, with given initial value `value`.
func (Float32) MarshalJSON ¶
MarshalJSON implements the interface MarshalJSON for json.Marshal.
func (*Float32) Set ¶
Set atomically stores `value` into t.value and returns the previous value of t.value.
func (*Float32) UnmarshalJSON ¶
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
func (*Float32) UnmarshalValue ¶
UnmarshalValue is an interface implement which sets any type of value for `v`.
type Float64 ¶
type Float64 struct {
// contains filtered or unexported fields
}
Float64 is a struct for concurrent-safe operation for type float64.
func NewFloat64 ¶
NewFloat64 creates and returns a concurrent-safe object for float64 type, with given initial value `value`.
func (Float64) MarshalJSON ¶
MarshalJSON implements the interface MarshalJSON for json.Marshal.
func (*Float64) Set ¶
Set atomically stores `value` into t.value and returns the previous value of t.value.
func (*Float64) UnmarshalJSON ¶
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
func (*Float64) UnmarshalValue ¶
UnmarshalValue is an interface implement which sets any type of value for `v`.
type Int ¶
type Int struct {
// contains filtered or unexported fields
}
Int is a struct for concurrent-safe operation for type int.
func NewInt ¶
NewInt creates and returns a concurrent-safe object for int type, with given initial value `value`.
func (Int) MarshalJSON ¶
MarshalJSON implements the interface MarshalJSON for json.Marshal.
func (*Int) Set ¶
Set atomically stores `value` into t.value and returns the previous value of t.value.
func (*Int) UnmarshalJSON ¶
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
func (*Int) UnmarshalValue ¶
UnmarshalValue is an interface implement which sets any type of value for `v`.
type Int32 ¶
type Int32 struct {
// contains filtered or unexported fields
}
Int32 is a struct for concurrent-safe operation for type int32.
func NewInt32 ¶
NewInt32 creates and returns a concurrent-safe object for int32 type, with given initial value `value`.
func (Int32) MarshalJSON ¶
MarshalJSON implements the interface MarshalJSON for json.Marshal.
func (*Int32) Set ¶
Set atomically stores `value` into t.value and returns the previous value of t.value.
func (*Int32) UnmarshalJSON ¶
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
func (*Int32) UnmarshalValue ¶
UnmarshalValue is an interface implement which sets any type of value for `v`.
type Int64 ¶
type Int64 struct {
// contains filtered or unexported fields
}
Int64 is a struct for concurrent-safe operation for type int64.
func NewInt64 ¶
NewInt64 creates and returns a concurrent-safe object for int64 type, with given initial value `value`.
func (Int64) MarshalJSON ¶
MarshalJSON implements the interface MarshalJSON for json.Marshal.
func (*Int64) Set ¶
Set atomically stores `value` into t.value and returns the previous value of t.value.
func (*Int64) UnmarshalJSON ¶
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
func (*Int64) UnmarshalValue ¶
UnmarshalValue is an interface implement which sets any type of value for `v`.
type Interface ¶
type Interface struct {
// contains filtered or unexported fields
}
Interface is a struct for concurrent-safe operation for type interface{}.
func New ¶
func New(value ...interface{}) *Interface
New is alias of NewInterface. See NewInterface.
func NewInterface ¶
func NewInterface(value ...interface{}) *Interface
NewInterface creates and returns a concurrent-safe object for interface{} type, with given initial value `value`.
func (*Interface) Clone ¶
Clone clones and returns a new concurrent-safe object for interface{} type.
func (Interface) MarshalJSON ¶
MarshalJSON implements the interface MarshalJSON for json.Marshal.
func (*Interface) Set ¶
func (v *Interface) Set(value interface{}) (old interface{})
Set atomically stores `value` into t.value and returns the previous value of t.value. Note: The parameter `value` cannot be nil.
func (*Interface) UnmarshalJSON ¶
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
func (*Interface) UnmarshalValue ¶
UnmarshalValue is an interface implement which sets any type of value for `v`.
type String ¶
type String struct {
// contains filtered or unexported fields
}
String is a struct for concurrent-safe operation for type string.
func NewString ¶
NewString creates and returns a concurrent-safe object for string type, with given initial value `value`.
func (String) MarshalJSON ¶
MarshalJSON implements the interface MarshalJSON for json.Marshal.
func (*String) Set ¶
Set atomically stores `value` into t.value and returns the previous value of t.value.
func (*String) UnmarshalJSON ¶
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
func (*String) UnmarshalValue ¶
UnmarshalValue is an interface implement which sets any type of value for `v`.
type Uint ¶
type Uint struct {
// contains filtered or unexported fields
}
Uint is a struct for concurrent-safe operation for type uint.
func NewUint ¶
NewUint creates and returns a concurrent-safe object for uint type, with given initial value `value`.
func (Uint) MarshalJSON ¶
MarshalJSON implements the interface MarshalJSON for json.Marshal.
func (*Uint) Set ¶
Set atomically stores `value` into t.value and returns the previous value of t.value.
func (*Uint) UnmarshalJSON ¶
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
func (*Uint) UnmarshalValue ¶
UnmarshalValue is an interface implement which sets any type of value for `v`.
type Uint32 ¶
type Uint32 struct {
// contains filtered or unexported fields
}
Uint32 is a struct for concurrent-safe operation for type uint32.
func NewUint32 ¶
NewUint32 creates and returns a concurrent-safe object for uint32 type, with given initial value `value`.
func (Uint32) MarshalJSON ¶
MarshalJSON implements the interface MarshalJSON for json.Marshal.
func (*Uint32) Set ¶
Set atomically stores `value` into t.value and returns the previous value of t.value.
func (*Uint32) UnmarshalJSON ¶
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
func (*Uint32) UnmarshalValue ¶
UnmarshalValue is an interface implement which sets any type of value for `v`.
type Uint64 ¶
type Uint64 struct {
// contains filtered or unexported fields
}
Uint64 is a struct for concurrent-safe operation for type uint64.
func NewUint64 ¶
NewUint64 creates and returns a concurrent-safe object for uint64 type, with given initial value `value`.
func (Uint64) MarshalJSON ¶
MarshalJSON implements the interface MarshalJSON for json.Marshal.
func (*Uint64) Set ¶
Set atomically stores `value` into t.value and returns the previous value of t.value.
func (*Uint64) UnmarshalJSON ¶
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
func (*Uint64) UnmarshalValue ¶
UnmarshalValue is an interface implement which sets any type of value for `v`.