Documentation ¶
Index ¶
- Constants
- type Bool
- type Int
- type Int32
- func (i *Int32) Add(n int32) (new int32)
- func (i *Int32) CompareAndSwap(old, new int32) (changed bool)
- func (i *Int32) Load() (n int32)
- func (i *Int32) MarshalJSON() (b []byte, err error)
- func (i *Int32) Store(new int32)
- func (i *Int32) Swap(new int32) (old int32)
- func (i *Int32) UnmarshalJSON(b []byte) (err error)
- type Int64
- func (i *Int64) Add(n int64) (new int64)
- func (i *Int64) CompareAndSwap(old, new int64) (changed bool)
- func (i *Int64) Load() (n int64)
- func (i *Int64) MarshalJSON() (b []byte, err error)
- func (i *Int64) Store(new int64)
- func (i *Int64) Swap(new int64) (old int64)
- func (i *Int64) UnmarshalJSON(b []byte) (err error)
- type MultiMux
- type Mux
- type RWMux
- type String
- type Uint
- func (u *Uint) Add(n uint) (new uint)
- func (u *Uint) CompareAndSwap(old, new uint) (changed bool)
- func (u *Uint) Load() (n uint)
- func (u *Uint) MarshalJSON() (b []byte, err error)
- func (u *Uint) Store(new uint)
- func (u *Uint) Swap(new uint) (old uint)
- func (u *Uint) UnmarshalJSON(b []byte) (err error)
- type Uint32
- func (u *Uint32) Add(n uint32) (new uint32)
- func (u *Uint32) CompareAndSwap(old, new uint32) (changed bool)
- func (u *Uint32) Load() (n uint32)
- func (u *Uint32) MarshalJSON() (b []byte, err error)
- func (u *Uint32) Store(new uint32)
- func (u *Uint32) Swap(new uint32) (old uint32)
- func (u *Uint32) UnmarshalJSON(b []byte) (err error)
- type Uint64
- func (u *Uint64) Add(n uint64) (new uint64)
- func (u *Uint64) CompareAndSwap(old, new uint64) (changed bool)
- func (u *Uint64) Load() (n uint64)
- func (u *Uint64) MarshalJSON() (b []byte, err error)
- func (u *Uint64) Store(new uint64)
- func (u *Uint64) Swap(new uint64) (old uint64)
- func (u *Uint64) UnmarshalJSON(b []byte) (err error)
- type Value
- func (av *Value) CompareAndSwap(fn func(oldV interface{}) (newV interface{}, ok bool)) (ok bool)
- func (av *Value) Load() (v interface{})
- func (av *Value) MarshalJSON() (b []byte, err error)
- func (av *Value) Store(v interface{})
- func (av *Value) Swap(newV interface{}) (oldV interface{})
- func (av *Value) UnmarshalJSON(b []byte) (err error)
Constants ¶
const ( // False state False int32 = iota // True state True )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
Bool is an atomic bool type
func (*Bool) MarshalJSON ¶
MarshalJSON is a json encoding helper function
func (*Bool) UnmarshalJSON ¶
UnmarshalJSON is a json decoding helper function
type Int ¶
type Int struct {
// contains filtered or unexported fields
}
Int is an atomic int
func (*Int) CompareAndSwap ¶
CompareAndSwap will perform an atomic compare and swap for an old and new value
func (*Int) MarshalJSON ¶
MarshalJSON is a json encoding helper function
func (*Int) UnmarshalJSON ¶
UnmarshalJSON is a json decoding helper function
type Int32 ¶
type Int32 struct {
// contains filtered or unexported fields
}
Int32 is an atomic int32
func (*Int32) CompareAndSwap ¶
CompareAndSwap will perform an atomic compare and swap for an old and new value
func (*Int32) MarshalJSON ¶
MarshalJSON is a json encoding helper function
func (*Int32) UnmarshalJSON ¶
UnmarshalJSON is a json decoding helper function
type Int64 ¶
type Int64 struct {
// contains filtered or unexported fields
}
Int64 is an atomic int64
func (*Int64) CompareAndSwap ¶
CompareAndSwap will perform an atomic compare and swap for an old and new value
func (*Int64) MarshalJSON ¶
MarshalJSON is a json encoding helper function
func (*Int64) UnmarshalJSON ¶
UnmarshalJSON is a json decoding helper function
type MultiMux ¶
type MultiMux struct {
// contains filtered or unexported fields
}
MultiMux allows to hold locks by a key.
func (*MultiMux) Delete ¶
Delete deletes the specific key, ensuring that it isn't used anywhere else.
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
Mux wraps a sync.Mutex to allow simple and safe operation on the mutex.
type RWMux ¶
type RWMux struct {
// contains filtered or unexported fields
}
RWMux wraps a sync.RWMutex to allow simple and safe operation on the mutex.
type String ¶
type String struct {
// contains filtered or unexported fields
}
String is a string type
func (*String) MarshalJSON ¶
MarshalJSON is a json encoding helper function
func (*String) UnmarshalJSON ¶
UnmarshalJSON is a json decoding helper function
type Uint ¶
type Uint struct {
// contains filtered or unexported fields
}
Uint is an atomic uint
func (*Uint) CompareAndSwap ¶
CompareAndSwap will perform an atomic compare and swap for an old and new value
func (*Uint) MarshalJSON ¶
MarshalJSON is a json encoding helper function
func (*Uint) UnmarshalJSON ¶
UnmarshalJSON is a json decoding helper function
type Uint32 ¶
type Uint32 struct {
// contains filtered or unexported fields
}
Uint32 is an atomic uint32
func (*Uint32) CompareAndSwap ¶
CompareAndSwap will perform an atomic compare and swap for an old and new value
func (*Uint32) MarshalJSON ¶
MarshalJSON is a json encoding helper function
func (*Uint32) UnmarshalJSON ¶
UnmarshalJSON is a json decoding helper function
type Uint64 ¶
type Uint64 struct {
// contains filtered or unexported fields
}
Uint64 is an atomic uint64
func (*Uint64) CompareAndSwap ¶
CompareAndSwap will perform an atomic compare and swap for an old and new value
func (*Uint64) MarshalJSON ¶
MarshalJSON is a json encoding helper function
func (*Uint64) UnmarshalJSON ¶
UnmarshalJSON is a json decoding helper function
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value is an atomic interface{}
func (*Value) CompareAndSwap ¶
CompareAndSwap will perform an atomic compare and swap for an old and new value, fn is expected to check the old value and return the new value and true, or return false
func (*Value) MarshalJSON ¶
MarshalJSON is a json encoding helper function
func (*Value) Store ¶
func (av *Value) Store(v interface{})
Store will perform an atomic store for a new value
func (*Value) Swap ¶
func (av *Value) Swap(newV interface{}) (oldV interface{})
Swap will perform an atomic swap for a new value and return the old value
func (*Value) UnmarshalJSON ¶
UnmarshalJSON is a json decoding helper function, to specify the type of the value make sure to call .Set with the zero type you want. Example:
v.Set(&Struct{})
err := json.Unmarshal(data, &v)