gtype

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 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) Cas

func (v *Bool) Cas(old, new bool) bool

Cas executes the compare-and-swap operation for value.

func (*Bool) Clone

func (v *Bool) Clone() *Bool

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

func (*Bool) Set

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

Set atomically stores <value> into t.value and returns the previous value of t.value.

func (*Bool) Val

func (v *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 (v *Byte) Add(delta byte) (new byte)

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

func (*Byte) Cas

func (v *Byte) Cas(old, new byte) bool

Cas executes the compare-and-swap operation for value.

func (*Byte) Clone

func (v *Byte) Clone() *Byte

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

func (*Byte) Set

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

Set atomically stores <value> into t.value and returns the previous value of t.value.

func (*Byte) Val

func (v *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 (v *Bytes) Clone() *Bytes

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

func (*Bytes) Set

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

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

func (*Bytes) Val

func (v *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 (v *Float32) Add(delta float32) (new float32)

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

func (*Float32) Cas

func (v *Float32) Cas(old, new float32) bool

Cas executes the compare-and-swap operation for value.

func (*Float32) Clone

func (v *Float32) Clone() *Float32

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

func (*Float32) Set

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

Set atomically stores <value> into t.value and returns the previous value of t.value.

func (*Float32) Val

func (v *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 (v *Float64) Add(delta float64) (new float64)

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

func (*Float64) Cas

func (v *Float64) Cas(old, new float64) bool

Cas executes the compare-and-swap operation for value.

func (*Float64) Clone

func (v *Float64) Clone() *Float64

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

func (*Float64) Set

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

Set atomically stores <value> into t.value and returns the previous value of t.value.

func (*Float64) Val

func (v *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 (v *Int) Add(delta int) (new int)

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

func (*Int) Cas

func (v *Int) Cas(old, new int) bool

Cas executes the compare-and-swap operation for value.

func (*Int) Clone

func (v *Int) Clone() *Int

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

func (*Int) Set

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

Set atomically stores <value> into t.value and returns the previous value of t.value.

func (*Int) Val

func (v *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 (v *Int32) Add(delta int32) (new int32)

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

func (*Int32) Cas

func (v *Int32) Cas(old, new int32) bool

Cas executes the compare-and-swap operation for value.

func (*Int32) Clone

func (v *Int32) Clone() *Int32

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

func (*Int32) Set

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

Set atomically stores <value> into t.value and returns the previous value of t.value.

func (*Int32) Val

func (v *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 (v *Int64) Add(delta int64) (new int64)

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

func (*Int64) Cas

func (v *Int64) Cas(old, new int64) bool

Cas executes the compare-and-swap operation for value.

func (*Int64) Clone

func (v *Int64) Clone() *Int64

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

func (*Int64) Set

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

Set atomically stores <value> into t.value and returns the previous value of t.value.

func (*Int64) Val

func (v *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 (v *Interface) Clone() *Interface

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

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

func (v *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 (v *String) Clone() *String

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

func (*String) Set

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

Set atomically stores <value> into t.value and returns the previous value of t.value.

func (*String) Val

func (v *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 (v *Uint) Add(delta uint) (new uint)

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

func (*Uint) Cas

func (v *Uint) Cas(old, new uint) bool

Cas executes the compare-and-swap operation for value.

func (*Uint) Clone

func (v *Uint) Clone() *Uint

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

func (*Uint) Set

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

Set atomically stores <value> into t.value and returns the previous value of t.value.

func (*Uint) Val

func (v *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 (v *Uint32) Add(delta uint32) (new uint32)

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

func (*Uint32) Cas

func (v *Uint32) Cas(old, new uint32) bool

Cas executes the compare-and-swap operation for value.

func (*Uint32) Clone

func (v *Uint32) Clone() *Uint32

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

func (*Uint32) Set

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

Set atomically stores <value> into t.value and returns the previous value of t.value.

func (*Uint32) Val

func (v *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 (v *Uint64) Add(delta uint64) (new uint64)

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

func (*Uint64) Cas

func (v *Uint64) Cas(old, new uint64) bool

Cas executes the compare-and-swap operation for value.

func (*Uint64) Clone

func (v *Uint64) Clone() *Uint64

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

func (*Uint64) Set

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

Set atomically stores <value> into t.value and returns the previous value of t.value.

func (*Uint64) Val

func (v *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