🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] ## 安装 ``` $ go get -u go.uber.org/atomic@v1 ``` ## 语法 ``` type Bool func NewBool(v bool) *Bool func (x *Bool) CAS(o, n bool) bool func (x *Bool) Load() bool func (x *Bool) MarshalJSON() ([]byte, error) func (x *Bool) Store(v bool) func (b *Bool) String() string func (x *Bool) Swap(o bool) bool func (b *Bool) Toggle() bool func (x *Bool) UnmarshalJSON(b []byte) error type Duration func NewDuration(v time.Duration) *Duration func (d *Duration) Add(n time.Duration) time.Duration func (x *Duration) CAS(o, n time.Duration) bool func (x *Duration) Load() time.Duration func (x *Duration) MarshalJSON() ([]byte, error) func (x *Duration) Store(v time.Duration) func (d *Duration) String() string func (d *Duration) Sub(n time.Duration) time.Duration func (x *Duration) Swap(o time.Duration) time.Duration func (x *Duration) UnmarshalJSON(b []byte) error type Error func NewError(v error) *Error func (x *Error) Load() error func (x *Error) Store(v error) type String func NewString(v string) *String func (x *String) Load() string func (s *String) MarshalText() ([]byte, error) func (x *String) Store(v string) func (s *String) String() string func (s *String) UnmarshalText(b []byte) error type Float64 type Int32 type Int32 type Uint64 type Int64 type Uint32 func NewUint32(i uint32) *Uint32 func (i *Uint32) Add(n uint32) uint32 func (i *Uint32) CAS(old, new uint32) bool func (i *Uint32) Dec() uint32 func (i *Uint32) Inc() uint32 func (i *Uint32) Load() uint32 func (i *Uint32) MarshalJSON() ([]byte, error) func (i *Uint32) Store(n uint32) func (i *Uint32) String() string func (i *Uint32) Sub(n uint32) uint32 func (i *Uint32) Swap(n uint32) uint32 func (i *Uint32) UnmarshalJSON(b []byte) error ```