utils

package module
v0.0.0-...-9ac5701 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

README

fish

go

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	STRING_PTR = reflect.TypeOf(String(""))
	INT32_PTR  = reflect.TypeOf(Int32(int32(0)))
	INT64_PTR  = reflect.TypeOf(Int64(int64(0)))
	UINT32_PTR = reflect.TypeOf(Uint32(uint32(0)))
	UINT64_PTR = reflect.TypeOf(Uint64(uint64(0)))
	BOOL_PTR   = reflect.TypeOf(Bool(false))

	STRING = reflect.TypeOf("")
	INT32  = reflect.TypeOf(int32(0))
	INT64  = reflect.TypeOf(int64(0))
	UINT32 = reflect.TypeOf(uint32(0))
	UINT64 = reflect.TypeOf(uint64(0))
	BOOL   = reflect.TypeOf(false)
)

Functions

func Atoi

func Atoi(s string) int

func Atol

func Atol(s string) int64

func Atou

func Atou(s string) uint

func Atoul

func Atoul(s string) uint64

func Bool

func Bool(b bool) *bool

func Int32

func Int32(i int32) *int32

func Int64

func Int64(i int64) *int64

func New

func New(v reflect.Value) interface{}

s := "a" ps := New(reflect.ValueOf(&a)).(*string) *ps = "hello" fmt.Println(*ps)

func NewFromType

func NewFromType(rt reflect.Type) interface{}

func String

func String(s string) *string

func StringCutLeft

func StringCutLeft(s string, offset int) string

func StringCutLeftExp

func StringCutLeftExp(s string, cutset string, n int) string

func StringCutRight

func StringCutRight(s string, offset int) string

func StringCutRightExp

func StringCutRightExp(s string, cutset string, n int) string

func StringIndexAny

func StringIndexAny(s, cutset string, n int) int

func StructTravel

func StructTravel(v interface{},
	qi QueryInterface,
	f func(v reflect.Value,
		t reflect.StructField,
		qi QueryInterface)) interface{}

func StructTravelFunc

func StructTravelFunc(v reflect.Value, t reflect.StructField, qi QueryInterface)

func StructTravelSet

func StructTravelSet(v interface{}, qi QueryInterface) interface{}

func Uint32

func Uint32(i uint32) *uint32

func Uint64

func Uint64(i uint64) *uint64

Types

type Pool

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

func NewPool

func NewPool(callback func(*Pool) (PoolElemInterface, error), maxIdle, maxActive, timer int32) *Pool

func (*Pool) Close

func (this *Pool) Close()

func (*Pool) Get

func (this *Pool) Get() (PoolElemInterface, error)

func (*Pool) IsClosed

func (this *Pool) IsClosed() bool

func (*Pool) Put

func (this *Pool) Put(elem PoolElemInterface)

func (*Pool) Update

func (this *Pool) Update(maxIdle, maxActive int32)

type PoolElem

type PoolElem struct {
	Error error
	Mux   sync.Mutex
	// contains filtered or unexported fields
}

func (*PoolElem) Active

func (this *PoolElem) Active()

func (*PoolElem) Err

func (this *PoolElem) Err() error

func (*PoolElem) Heartbeat

func (this *PoolElem) Heartbeat()

func (*PoolElem) IsTimeout

func (this *PoolElem) IsTimeout() bool

func (*PoolElem) SetErr

func (this *PoolElem) SetErr(err error)

func (*PoolElem) Timeout

func (this *PoolElem) Timeout()

type PoolElemInterface

type PoolElemInterface interface {
	Recycle() //回收
	Close()
	Err() error
	SetErr(error)
	Active()         //激活
	Heartbeat()      //心跳
	Timeout()        //设置超时,激活心跳
	IsTimeout() bool //是否超时
}

type QueryInterface

type QueryInterface interface {
	Query(t reflect.StructField) string
}

type SafeSet

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

func NewSafeSet

func NewSafeSet() *SafeSet

func (*SafeSet) Has

func (this *SafeSet) Has(v interface{}) bool

func (*SafeSet) Insert

func (this *SafeSet) Insert(v interface{})

func (*SafeSet) Range

func (this *SafeSet) Range(callback SetCallback, vs ...interface{})

func (*SafeSet) Remove

func (this *SafeSet) Remove(v interface{})

func (*SafeSet) Size

func (this *SafeSet) Size() int

func (*SafeSet) ToSlice

func (this *SafeSet) ToSlice() []interface{}

func (*SafeSet) Wake

func (this *SafeSet) Wake()

type Set

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

func NewSet

func NewSet() *Set

func (*Set) Has

func (this *Set) Has(v interface{}) bool

func (*Set) Insert

func (this *Set) Insert(v interface{})

func (*Set) Range

func (this *Set) Range(callback SetCallback, vs ...interface{})

func (*Set) Remove

func (this *Set) Remove(v interface{})

func (*Set) Size

func (this *Set) Size() int

func (*Set) ToSlice

func (this *Set) ToSlice() []interface{}

func (*Set) Wake

func (this *Set) Wake()

type SetCallback

type SetCallback func(v interface{}, vs ...interface{})

type SetInterface

type SetInterface interface {
	Insert(v interface{})
	Has(v interface{}) bool
	Remove(v interface{})
	Range(callback SetCallback, vs ...interface{})
	Size() int
	ToSlice() []interface{}
	Wake() //防止读锁一直占用,而写锁被卡住
}

Directories

Path Synopsis
beego
httplib
Usage: import "github.com/astaxie/beego/httplib" b := httplib.Post("http://beego.me/") b.Param("username","astaxie") b.Param("password","123456") b.PostFile("uploadfile1", "httplib.pdf") b.PostFile("uploadfile2", "httplib.txt") str, err := b.String() if err != nil { t.Fatal(err) } fmt.Println(str) more docs http://beego.me/docs/module/httplib.md
Usage: import "github.com/astaxie/beego/httplib" b := httplib.Post("http://beego.me/") b.Param("username","astaxie") b.Param("password","123456") b.PostFile("uploadfile1", "httplib.pdf") b.PostFile("uploadfile2", "httplib.txt") str, err := b.String() if err != nil { t.Fatal(err) } fmt.Println(str) more docs http://beego.me/docs/module/httplib.md

Jump to

Keyboard shortcuts

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