gtype

package
v0.0.0-...-3631402 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2018 License: MIT Imports: 3 Imported by: 0

README

benchmarks:

john@johnstation:~/Workspace/Go/GOPATH/src/gitee.com/johng/gf/g/container/gtype$ go test *.go -bench=".*"
goos: linux
goarch: amd64
BenchmarkInt_Set-8         	300000000	         5.65 ns/op
BenchmarkInt_Val-8         	2000000000	         0.35 ns/op
BenchmarkInt_Add-8         	300000000	         5.68 ns/op
BenchmarkInt32_Set-8       	300000000	         5.67 ns/op
BenchmarkInt32_Val-8       	2000000000	         0.36 ns/op
BenchmarkInt32_Add-8       	300000000	         5.68 ns/op
BenchmarkInt64_Set-8       	300000000	         5.66 ns/op
BenchmarkInt64_Val-8       	2000000000	         0.35 ns/op
BenchmarkInt64_Add-8       	300000000	         5.67 ns/op
BenchmarkUint_Set-8        	300000000	         5.68 ns/op
BenchmarkUint_Val-8        	2000000000	         0.34 ns/op
BenchmarkUint_Add-8        	300000000	         5.68 ns/op
BenchmarkUint32_Set-8      	300000000	         5.65 ns/op
BenchmarkUint32_Val-8      	2000000000	         0.34 ns/op
BenchmarkUint32_Add-8      	300000000	         5.66 ns/op
BenchmarkUint64_Set-8      	300000000	         5.68 ns/op
BenchmarkUint64_Val-8      	2000000000	         0.34 ns/op
BenchmarkUint64_Add-8      	300000000	         5.68 ns/op
BenchmarkBool_Set-8        	300000000	         5.67 ns/op
BenchmarkBool_Val-8        	2000000000	         0.34 ns/op
BenchmarkString_Set-8      	30000000	        48.5 ns/op
BenchmarkString_Val-8      	100000000	        12.3 ns/op
BenchmarkBytes_Set-8       	50000000	        34.9 ns/op
BenchmarkBytes_Val-8       	100000000	        12.5 ns/op
BenchmarkInterface_Set-8   	50000000	        34.2 ns/op
BenchmarkInterface_Val-8   	100000000	        12.2 ns/op
PASS
ok  	command-line-arguments	43.447s

Documentation

Overview

并发安全的基本类型.

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

func (*Bool) Set

func (t *Bool) Set(value bool)

func (*Bool) Val

func (t *Bool) Val() bool

type Byte

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

func NewByte

func NewByte(value ...byte) *Byte

func (*Byte) Add

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

func (*Byte) Set

func (t *Byte) Set(value byte)

func (*Byte) Val

func (t *Byte) Val() byte

type Bytes

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

func NewBytes

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

func (*Bytes) LockFunc

func (t *Bytes) LockFunc(f func(value []byte) []byte)

使用自定义方法执行加锁修改操作

func (*Bytes) RLockFunc

func (t *Bytes) RLockFunc(f func(value []byte))

使用自定义方法执行加锁读取操作

func (*Bytes) Set

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

func (*Bytes) Val

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

type Float32

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

func NewFloat32

func NewFloat32(value ...float32) *Float32

func (*Float32) Add

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

func (*Float32) Set

func (t *Float32) Set(value float32)

func (*Float32) Val

func (t *Float32) Val() float32

type Float64

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

func NewFloat64

func NewFloat64(value ...float64) *Float64

func (*Float64) Add

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

func (*Float64) Set

func (t *Float64) Set(value float64)

func (*Float64) Val

func (t *Float64) Val() float64

type Int

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

func NewInt

func NewInt(value ...int) *Int

func (*Int) Add

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

func (*Int) Set

func (t *Int) Set(value int)

func (*Int) Val

func (t *Int) Val() int

type Int32

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

func NewInt32

func NewInt32(value ...int32) *Int32

func (*Int32) Add

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

func (*Int32) Set

func (t *Int32) Set(value int32)

func (*Int32) Val

func (t *Int32) Val() int32

type Int64

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

func NewInt64

func NewInt64(value ...int64) *Int64

func (*Int64) Add

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

func (*Int64) Set

func (t *Int64) Set(value int64)

func (*Int64) Val

func (t *Int64) Val() int64

type Interface

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

比较通用的并发安全数据类型

func NewInterface

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

func (*Interface) LockFunc

func (t *Interface) LockFunc(f func(value interface{}) interface{})

使用自定义方法执行加锁修改操作

func (*Interface) RLockFunc

func (t *Interface) RLockFunc(f func(value interface{}))

使用自定义方法执行加锁读取操作

func (*Interface) Set

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

func (*Interface) Val

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

type String

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

func NewString

func NewString(value ...string) *String

func (*String) LockFunc

func (t *String) LockFunc(f func(value string) string)

使用自定义方法执行加锁修改操作

func (*String) RLockFunc

func (t *String) RLockFunc(f func(value string))

使用自定义方法执行加锁读取操作

func (*String) Set

func (t *String) Set(value string)

func (*String) Val

func (t *String) Val() string

type Uint

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

func NewUint

func NewUint(value ...uint) *Uint

func (*Uint) Add

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

func (*Uint) Set

func (t *Uint) Set(value uint)

func (*Uint) Val

func (t *Uint) Val() uint

type Uint32

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

func NewUint32

func NewUint32(value ...uint32) *Uint32

func (*Uint32) Add

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

func (*Uint32) Set

func (t *Uint32) Set(value uint32)

func (*Uint32) Val

func (t *Uint32) Val() uint32

type Uint64

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

func NewUint64

func NewUint64(value ...uint64) *Uint64

func (*Uint64) Add

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

func (*Uint64) Set

func (t *Uint64) Set(value uint64)

func (*Uint64) Val

func (t *Uint64) Val() uint64

Jump to

Keyboard shortcuts

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