Documentation ¶
Overview ¶
Package gtype provides kinds of high performance and concurrent-safe basic variable types.
Index ¶
- type 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) 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) 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) Val() float64
- type 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) 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) Val() int64
- type Interface
- type String
- type Type
- 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) 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) 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) 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 ¶ added in v1.9.7
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 ¶ added in v1.9.7
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
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 ¶ added in v1.9.7
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 ¶ added in v1.9.7
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
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 ¶ added in v1.9.7
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 ¶ added in v1.9.7
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
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 ¶ added in v1.9.7
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 ¶ added in v1.9.7
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
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 ¶ added in v1.9.7
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 ¶ added in v1.9.7
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
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 ¶ added in v1.9.7
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 ¶ added in v1.9.7
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
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 ¶ added in v1.9.7
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 ¶ added in v1.9.7
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
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 ¶ added in v1.9.7
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 ¶ added in v1.9.7
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
type Interface ¶
type Interface struct {
// contains filtered or unexported fields
}
Interface is a struct for concurrent-safe operation for type interface{}.
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 ¶ added in v1.9.7
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 ¶ added in v1.9.7
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
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 ¶ added in v1.9.7
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 ¶ added in v1.9.7
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
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 ¶ added in v1.9.7
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 ¶ added in v1.9.7
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
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 ¶ added in v1.9.7
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 ¶ added in v1.9.7
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
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 ¶ added in v1.9.7
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 ¶ added in v1.9.7
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.