gtype

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

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
}

Bool is a struct for concurrent-safe operation for type bool.

func NewBool

func NewBool(value ...bool) *Bool

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

func (*Bool) Cas

func (v *Bool) Cas(old, new bool) (swapped 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) MarshalJSON

func (v *Bool) MarshalJSON() ([]byte, error)

MarshalJSON implements the interface MarshalJSON for json.Marshal.

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

func (v *Bool) String() string

String implements String interface for string printing.

func (*Bool) UnmarshalJSON

func (v *Bool) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.

func (*Bool) UnmarshalValue

func (v *Bool) UnmarshalValue(value interface{}) error

UnmarshalValue is an interface implement which sets any type of value for <v>.

func (*Bool) Val

func (v *Bool) Val() bool

Val atomically loads and returns t.valueue.

type Int

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

Int is a struct for concurrent-safe operation for type int.

func NewInt

func NewInt(value ...int) *Int

NewInt creates and 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) (swapped 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) MarshalJSON

func (v *Int) MarshalJSON() ([]byte, error)

MarshalJSON implements the interface MarshalJSON for json.Marshal.

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

func (v *Int) String() string

String implements String interface for string printing.

func (*Int) UnmarshalJSON

func (v *Int) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.

func (*Int) UnmarshalValue

func (v *Int) UnmarshalValue(value interface{}) error

UnmarshalValue is an interface implement which sets any type of value for <v>.

func (*Int) Val

func (v *Int) Val() int

Val atomically loads and returns t.value.

type Int32

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

Int32 is a struct for concurrent-safe operation for type int32.

func NewInt32

func NewInt32(value ...int32) *Int32

NewInt32 creates and 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) (swapped 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) MarshalJSON

func (v Int32) MarshalJSON() ([]byte, error)

MarshalJSON implements the interface MarshalJSON for json.Marshal.

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

func (v *Int32) String() string

String implements String interface for string printing.

func (*Int32) UnmarshalJSON

func (v *Int32) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.

func (*Int32) UnmarshalValue

func (v *Int32) UnmarshalValue(value interface{}) error

UnmarshalValue is an interface implement which sets any type of value for `v`.

func (*Int32) Val

func (v *Int32) Val() int32

Val atomically loads and returns t.value.

type Int64

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

Int64 is a struct for concurrent-safe operation for type int64.

func NewInt64

func NewInt64(value ...int64) *Int64

NewInt64 creates and 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) (swapped 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) MarshalJSON

func (v *Int64) MarshalJSON() ([]byte, error)

MarshalJSON implements the interface MarshalJSON for json.Marshal.

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

func (v *Int64) String() string

String implements String interface for string printing.

func (*Int64) UnmarshalJSON

func (v *Int64) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.

func (*Int64) UnmarshalValue

func (v *Int64) UnmarshalValue(value interface{}) error

UnmarshalValue is an interface implement which sets any type of value for <v>.

func (*Int64) Val

func (v *Int64) Val() int64

Val atomically loads and returns t.value.

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

func (v *Interface) Clone() *Interface

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

func (*Interface) MarshalJSON

func (v *Interface) MarshalJSON() ([]byte, error)

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

func (v *Interface) String() string

String implements String interface for string printing.

func (*Interface) UnmarshalJSON

func (v *Interface) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.

func (*Interface) UnmarshalValue

func (v *Interface) UnmarshalValue(value interface{}) error

UnmarshalValue is an interface implement which sets any type of value for <v>.

func (*Interface) Val

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

Val atomically loads and returns t.value.

Jump to

Keyboard shortcuts

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