gtype

package
v1.6.7 Latest Latest
Warning

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

Go to latest
Published: May 3, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package gtype provides kinds of high performance and concurrent-safe basic variable types.

Index

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
}

func NewBool

func NewBool(value ...bool) *Bool

NewBool returns a concurrent-safe object for bool type, with given initial value <value>.

func (*Bool) Clone

func (t *Bool) Clone() *Bool

Clone clones and returns a new concurrent-safe object for bool type.

func (*Bool) Set

func (t *Bool) Set(value bool) (old bool)

Set atomically stores value into t.valueue and returns the previous t.value value.

func (*Bool) Val

func (t *Bool) Val() bool

Val atomically loads t.valueue.

type Byte

type Byte struct {
	// contains filtered or unexported fields
}

func NewByte

func NewByte(value ...byte) *Byte

NewByte returns a concurrent-safe object for byte type, with given initial value <value>.

func (*Byte) Add

func (t *Byte) Add(delta int) (new byte)

Add atomically adds delta to t.value and returns the new value.

func (*Byte) Clone

func (t *Byte) Clone() *Byte

Clone clones and returns a new concurrent-safe object for byte type.

func (*Byte) Set

func (t *Byte) Set(value byte) (old byte)

Set atomically stores value into t.value and returns the previous t.value value.

func (*Byte) Val

func (t *Byte) Val() byte

Val atomically loads t.value.

type Bytes

type Bytes struct {
	// contains filtered or unexported fields
}

func NewBytes

func NewBytes(value ...[]byte) *Bytes

NewBytes returns a concurrent-safe object for []byte type, with given initial value <value>.

func (*Bytes) Clone

func (t *Bytes) Clone() *Bytes

Clone clones and returns a new concurrent-safe object for []byte type.

func (*Bytes) Set

func (t *Bytes) Set(value []byte) (old []byte)

Set atomically stores value into t.value and returns the previous t.value value. Note: The parameter <value> cannot be nil.

func (*Bytes) Val

func (t *Bytes) Val() []byte

Val atomically loads t.value.

type Float32

type Float32 struct {
	// contains filtered or unexported fields
}

func NewFloat32

func NewFloat32(value ...float32) *Float32

NewFloat32 returns a concurrent-safe object for float32 type, with given initial value <value>.

func (*Float32) Add

func (t *Float32) Add(delta float32) (new float32)

Add atomically adds delta to t.value and returns the new value.

func (*Float32) Clone

func (t *Float32) Clone() *Float32

Clone clones and returns a new concurrent-safe object for float32 type.

func (*Float32) Set

func (t *Float32) Set(value float32) (old float32)

Set atomically stores value into t.value and returns the previous t.value value.

func (*Float32) Val

func (t *Float32) Val() float32

Val atomically loads t.value.

type Float64

type Float64 struct {
	// contains filtered or unexported fields
}

func NewFloat64

func NewFloat64(value ...float64) *Float64

NewFloat64 returns a concurrent-safe object for float64 type, with given initial value <value>.

func (*Float64) Add

func (t *Float64) Add(delta float64) (new float64)

Add atomically adds delta to t.value and returns the new value.

func (*Float64) Clone

func (t *Float64) Clone() *Float64

Clone clones and returns a new concurrent-safe object for float64 type.

func (*Float64) Set

func (t *Float64) Set(value float64) (old float64)

Set atomically stores value into t.value and returns the previous t.value value.

func (*Float64) Val

func (t *Float64) Val() float64

Val atomically loads t.value.

type Int

type Int struct {
	// contains filtered or unexported fields
}

func NewInt

func NewInt(value ...int) *Int

NewInt returns a concurrent-safe object for int type, with given initial value <value>.

func (*Int) Add

func (t *Int) Add(delta int) (new int)

Add atomically adds delta to t.value and returns the new value.

func (*Int) Clone

func (t *Int) Clone() *Int

Clone clones and returns a new concurrent-safe object for int type.

func (*Int) Set

func (t *Int) Set(value int) (old int)

Set atomically stores value into t.value and returns the previous t.value value.

func (*Int) Val

func (t *Int) Val() int

Val atomically loads t.value.

type Int32

type Int32 struct {
	// contains filtered or unexported fields
}

func NewInt32

func NewInt32(value ...int32) *Int32

NewInt32 returns a concurrent-safe object for int32 type, with given initial value <value>.

func (*Int32) Add

func (t *Int32) Add(delta int32) (new int32)

Add atomically adds delta to t.value and returns the new value.

func (*Int32) Clone

func (t *Int32) Clone() *Int32

Clone clones and returns a new concurrent-safe object for int32 type.

func (*Int32) Set

func (t *Int32) Set(value int32) (old int32)

Set atomically stores value into t.value and returns the previous t.value value.

func (*Int32) Val

func (t *Int32) Val() int32

Val atomically loads t.value.

type Int64

type Int64 struct {
	// contains filtered or unexported fields
}

func NewInt64

func NewInt64(value ...int64) *Int64

NewInt64 returns a concurrent-safe object for int64 type, with given initial value <value>.

func (*Int64) Add

func (t *Int64) Add(delta int64) int64

Add atomically adds delta to t.value and returns the new value.

func (*Int64) Clone

func (t *Int64) Clone() *Int64

Clone clones and returns a new concurrent-safe object for int64 type.

func (*Int64) Set

func (t *Int64) Set(value int64) (old int64)

Set atomically stores value into t.value and returns the previous t.value value.

func (*Int64) Val

func (t *Int64) Val() int64

Val atomically loads t.value.

type Interface

type Interface struct {
	// contains filtered or unexported fields
}

func NewInterface

func NewInterface(value ...interface{}) *Interface

NewInterface returns a concurrent-safe object for interface{} type, with given initial value <value>.

func (*Interface) Clone

func (t *Interface) Clone() *Interface

Clone clones and returns a new concurrent-safe object for interface{} type.

func (*Interface) Set

func (t *Interface) Set(value interface{}) (old interface{})

Set atomically stores value into t.value and returns the previous t.value value. Note: The parameter <value> cannot be nil.

func (*Interface) Val

func (t *Interface) Val() interface{}

Val atomically loads t.value.

type String

type String struct {
	// contains filtered or unexported fields
}

func NewString

func NewString(value ...string) *String

NewString returns a concurrent-safe object for string type, with given initial value <value>.

func (*String) Clone

func (t *String) Clone() *String

Clone clones and returns a new concurrent-safe object for string type.

func (*String) Set

func (t *String) Set(value string) (old string)

Set atomically stores value into t.value and returns the previous t.value value.

func (*String) Val

func (t *String) Val() string

Val atomically loads t.value.

type Type

type Type = Interface

func New

func New(value ...interface{}) *Type

See NewInterface.

type Uint

type Uint struct {
	// contains filtered or unexported fields
}

func NewUint

func NewUint(value ...uint) *Uint

NewUint returns a concurrent-safe object for uint type, with given initial value <value>.

func (*Uint) Add

func (t *Uint) Add(delta uint) (new uint)

Add atomically adds delta to t.value and returns the new value.

func (*Uint) Clone

func (t *Uint) Clone() *Uint

Clone clones and returns a new concurrent-safe object for uint type.

func (*Uint) Set

func (t *Uint) Set(value uint) (old uint)

Set atomically stores value into t.value and returns the previous t.value value.

func (*Uint) Val

func (t *Uint) Val() uint

Val atomically loads t.value.

type Uint32

type Uint32 struct {
	// contains filtered or unexported fields
}

func NewUint32

func NewUint32(value ...uint32) *Uint32

NewUint32 returns a concurrent-safe object for uint32 type, with given initial value <value>.

func (*Uint32) Add

func (t *Uint32) Add(delta uint32) (new uint32)

Add atomically adds delta to t.value and returns the new value.

func (*Uint32) Clone

func (t *Uint32) Clone() *Uint32

Clone clones and returns a new concurrent-safe object for uint32 type.

func (*Uint32) Set

func (t *Uint32) Set(value uint32) (old uint32)

Set atomically stores value into t.value and returns the previous t.value value.

func (*Uint32) Val

func (t *Uint32) Val() uint32

Val atomically loads t.value.

type Uint64

type Uint64 struct {
	// contains filtered or unexported fields
}

func NewUint64

func NewUint64(value ...uint64) *Uint64

NewUint64 returns a concurrent-safe object for uint64 type, with given initial value <value>.

func (*Uint64) Add

func (t *Uint64) Add(delta uint64) (new uint64)

Add atomically adds delta to t.value and returns the new value.

func (*Uint64) Clone

func (t *Uint64) Clone() *Uint64

Clone clones and returns a new concurrent-safe object for uint64 type.

func (*Uint64) Set

func (t *Uint64) Set(value uint64) (old uint64)

Set atomically stores value into t.value and returns the previous t.value value.

func (*Uint64) Val

func (t *Uint64) Val() uint64

Val atomically loads t.value.

Jump to

Keyboard shortcuts

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