utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileExist

func FileExist(filename string) bool

Types

type AsyncTask

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

func NewAsyncTask

func NewAsyncTask(handler interface{}, params ...interface{}) *AsyncTask

func (*AsyncTask) Do

func (p *AsyncTask) Do() []reflect.Value

吃掉异步任务异常

type AsyncTaskPool

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

func NewAsyncTaskPool

func NewAsyncTaskPool(threads int, taskChanSize int) *AsyncTaskPool

func (*AsyncTaskPool) Close

func (p *AsyncTaskPool) Close(waitTaskDone bool, waitThreadStop bool)

func (*AsyncTaskPool) Do

func (p *AsyncTaskPool) Do(handler interface{}, params ...interface{})

注意,添加的异步任务不能抛异常

type MapWithRWMutex

type MapWithRWMutex struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewMapWithRWMutex

func NewMapWithRWMutex() *MapWithRWMutex

func (*MapWithRWMutex) Add

func (p *MapWithRWMutex) Add(key interface{}, value interface{}) (err error)

如果key已存在,就不会设置

func (*MapWithRWMutex) Clear

func (p *MapWithRWMutex) Clear()

func (*MapWithRWMutex) Get

func (p *MapWithRWMutex) Get(key interface{}) (value interface{}, ok bool)

func (*MapWithRWMutex) Has

func (p *MapWithRWMutex) Has(key interface{}) bool

func (*MapWithRWMutex) IsEmpty

func (p *MapWithRWMutex) IsEmpty() bool

func (*MapWithRWMutex) Items

func (p *MapWithRWMutex) Items() (keys []interface{}, values []interface{})

func (*MapWithRWMutex) Keys

func (p *MapWithRWMutex) Keys() (keys []interface{})

func (*MapWithRWMutex) Len

func (p *MapWithRWMutex) Len() int

func (*MapWithRWMutex) PopOne

func (p *MapWithRWMutex) PopOne() (value interface{}, ok bool)

func (*MapWithRWMutex) Remove

func (p *MapWithRWMutex) Remove(key interface{}) (err error)

func (*MapWithRWMutex) Set

func (p *MapWithRWMutex) Set(key interface{}, value interface{})

key不存在就新增,key存在就覆盖

func (*MapWithRWMutex) Values

func (p *MapWithRWMutex) Values() (values []interface{})

type Set

type Set struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New() *Set

func (*Set) Add

func (p *Set) Add(item interface{})

func (*Set) Clear

func (p *Set) Clear()

func (*Set) Has

func (p *Set) Has(item interface{}) bool

func (*Set) IsEmpty

func (p *Set) IsEmpty() bool

func (*Set) Len

func (p *Set) Len() int

func (*Set) List

func (p *Set) List() []interface{}

func (*Set) PopOne

func (p *Set) PopOne() (item interface{}, ok bool)

func (*Set) Remove

func (p *Set) Remove(item interface{})

Jump to

Keyboard shortcuts

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