Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
gqcn committed Feb 15, 2019
1 parent 22ac6b5 commit ee17872
Show file tree
Hide file tree
Showing 65 changed files with 156 additions and 523 deletions.
5 changes: 4 additions & 1 deletion container/garray/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
import "github.com/gogf/gf/g/container/garray"
```

**接口文档**[godoc.org/github.com/gogf/gf/g/container/garray](https://godoc.org/github.com/gogf/gf/g/container/garray)
**接口文档**

[godoc.org/github.com/gogf/gf/g/container/garray](https://godoc.org/github.com/gogf/gf/g/container/garray)


由于`garray`模块下的对象及方法较多,支持`int`/`string`/`interface{}`三种数据类型,这里便不一一列举。`garray`下包含了多种数据类型的slice,可以使用 `garray.New*Array`/`garray.NewSorted*Array` 方法来创建,其中`garray.New*Array`为普通不排序数组,`garray.NewSorted*Array`为排序数组(当创建`interface{}`类型的数组时,创建时可以指定自定义的排序函数)。

Expand Down
4 changes: 3 additions & 1 deletion container/gchan/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
import "github.com/gogf/gf/g/container/gchan"
```

**接口文档**[godoc.org/github.com/gogf/gf/g/container/gchan](https://godoc.org/github.com/gogf/gf/g/container/gchan)
**接口文档**

[godoc.org/github.com/gogf/gf/g/container/gchan](https://godoc.org/github.com/gogf/gf/g/container/gchan)

```go
type Chan
Expand Down
28 changes: 3 additions & 25 deletions container/glist/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,9 @@
import "github.com/gogf/gf/g/container/glist"
```

**接口文档**[godoc.org/github.com/gogf/gf/g/container/glist](https://godoc.org/github.com/gogf/gf/g/container/glist)
```go
type SafeList
func New(unsafe ...bool) *List
func (this *List) Back() *list.Element
func (this *List) BackAll() []interface{}
func (this *List) BackItem() interface{}
func (this *List) BatchPopBack(max int) []interface{}
func (this *List) BatchPopFront(max int) []interface{}
func (this *List) BatchPushFront(vs []interface{})
func (this *List) Front() *list.Element
func (this *List) FrontAll() []interface{}
func (this *List) FrontItem() interface{}
func (this *List) InsertAfter(v interface{}, mark *list.Element) *list.Element
func (this *List) InsertBefore(v interface{}, mark *list.Element) *list.Element
func (this *List) Len() int
func (this *List) PopBack() interface{}
func (this *List) PopBackAll() []interface{}
func (this *List) PopFront() interface{}
func (this *List) PopFrontAll() []interface{}
func (this *List) PushBack(v interface{}) *list.Element
func (this *List) PushFront(v interface{}) *list.Element
func (this *List) Remove(e *list.Element) interface{}
func (this *List) RemoveAll()
```
**接口文档**

[godoc.org/github.com/gogf/gf/g/container/glist](https://godoc.org/github.com/gogf/gf/g/container/glist)

## 性能基准测试

Expand Down
195 changes: 2 additions & 193 deletions container/gmap/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,201 +13,10 @@
import "github.com/gogf/gf/g/container/gmap"
```

**接口文档**[godoc.org/github.com/gogf/gf/g/container/gmap](https://godoc.org/github.com/gogf/gf/g/container/gmap)
**接口文档**

<!-- 由于`gmap`模块下的对象及方法比较多,这里便不一一列举。`gmap`下包含了多种数据类型的map,可以使用 `gmap.New*` 方法来创建。 -->
[godoc.org/github.com/gogf/gf/g/container/gmap](https://godoc.org/github.com/gogf/gf/g/container/gmap)

```go
type IntBoolMap
func NewIntBoolMap(unsafe ...bool) *IntBoolMap
func (this *IntBoolMap) BatchRemove(keys []int)
func (this *IntBoolMap) BatchSet(m map[int]bool)
func (this *IntBoolMap) Clear()
func (this *IntBoolMap) Clone() map[int]bool
func (this *IntBoolMap) Contains(key int) bool
func (this *IntBoolMap) Get(key int) bool
func (this *IntBoolMap) GetOrSet(key int, value bool) bool
func (this *IntBoolMap) GetOrSetFunc(key int, f func() bool) bool
func (this *IntBoolMap) GetOrSetFuncLock(key int, f func() bool) bool
func (this *IntBoolMap) IsEmpty() bool
func (this *IntBoolMap) Iterator(f func(k int, v bool) bool)
func (this *IntBoolMap) Keys() []int
func (this *IntBoolMap) LockFunc(f func(m map[int]bool))
func (this *IntBoolMap) RLockFunc(f func(m map[int]bool))
func (this *IntBoolMap) Remove(key int) bool
func (this *IntBoolMap) Set(key int, val bool)
func (this *IntBoolMap) SetIfNotExist(key int, value bool) bool
func (this *IntBoolMap) Size() int
type IntIntMap
func NewIntIntMap(unsafe ...bool) *IntIntMap
func (this *IntIntMap) BatchRemove(keys []int)
func (this *IntIntMap) BatchSet(m map[int]int)
func (this *IntIntMap) Clear()
func (this *IntIntMap) Clone() map[int]int
func (this *IntIntMap) Contains(key int) bool
func (this *IntIntMap) Get(key int) int
func (this *IntIntMap) GetOrSet(key int, value int) int
func (this *IntIntMap) GetOrSetFunc(key int, f func() int) int
func (this *IntIntMap) GetOrSetFuncLock(key int, f func() int) int
func (this *IntIntMap) IsEmpty() bool
func (this *IntIntMap) Iterator(f func(k int, v int) bool)
func (this *IntIntMap) Keys() []int
func (this *IntIntMap) LockFunc(f func(m map[int]int))
func (this *IntIntMap) RLockFunc(f func(m map[int]int))
func (this *IntIntMap) Remove(key int) int
func (this *IntIntMap) Set(key int, val int)
func (this *IntIntMap) SetIfNotExist(key int, value int) bool
func (this *IntIntMap) Size() int
func (this *IntIntMap) Values() []int
type IntInterfaceMap
func NewIntInterfaceMap(unsafe ...bool) *IntInterfaceMap
func (this *IntInterfaceMap) BatchRemove(keys []int)
func (this *IntInterfaceMap) BatchSet(m map[int]interface{})
func (this *IntInterfaceMap) Clear()
func (this *IntInterfaceMap) Clone() map[int]interface{}
func (this *IntInterfaceMap) Contains(key int) bool
func (this *IntInterfaceMap) Get(key int) interface{}
func (this *IntInterfaceMap) GetOrSet(key int, value interface{}) interface{}
func (this *IntInterfaceMap) GetOrSetFunc(key int, f func() interface{}) interface{}
func (this *IntInterfaceMap) GetOrSetFuncLock(key int, f func() interface{}) interface{}
func (this *IntInterfaceMap) IsEmpty() bool
func (this *IntInterfaceMap) Iterator(f func(k int, v interface{}) bool)
func (this *IntInterfaceMap) Keys() []int
func (this *IntInterfaceMap) LockFunc(f func(m map[int]interface{}))
func (this *IntInterfaceMap) RLockFunc(f func(m map[int]interface{}))
func (this *IntInterfaceMap) Remove(key int) interface{}
func (this *IntInterfaceMap) Set(key int, val interface{})
func (this *IntInterfaceMap) SetIfNotExist(key int, value interface{}) bool
func (this *IntInterfaceMap) Size() int
func (this *IntInterfaceMap) Values() []interface{}
type IntStringMap
func NewIntStringMap(unsafe ...bool) *IntStringMap
func (this *IntStringMap) BatchRemove(keys []int)
func (this *IntStringMap) BatchSet(m map[int]string)
func (this *IntStringMap) Clear()
func (this *IntStringMap) Clone() map[int]string
func (this *IntStringMap) Contains(key int) bool
func (this *IntStringMap) Get(key int) string
func (this *IntStringMap) GetOrSet(key int, value string) string
func (this *IntStringMap) GetOrSetFunc(key int, f func() string) string
func (this *IntStringMap) GetOrSetFuncLock(key int, f func() string) string
func (this *IntStringMap) IsEmpty() bool
func (this *IntStringMap) Iterator(f func(k int, v string) bool)
func (this *IntStringMap) Keys() []int
func (this *IntStringMap) LockFunc(f func(m map[int]string))
func (this *IntStringMap) RLockFunc(f func(m map[int]string))
func (this *IntStringMap) Remove(key int) string
func (this *IntStringMap) Set(key int, val string)
func (this *IntStringMap) SetIfNotExist(key int, value string) bool
func (this *IntStringMap) Size() int
func (this *IntStringMap) Values() []string
type InterfaceInterfaceMap
func NewInterfaceInterfaceMap(unsafe ...bool) *InterfaceInterfaceMap
func (this *InterfaceInterfaceMap) BatchRemove(keys []interface{})
func (this *InterfaceInterfaceMap) BatchSet(m map[interface{}]interface{})
func (this *InterfaceInterfaceMap) Clear()
func (this *InterfaceInterfaceMap) Clone() map[interface{}]interface{}
func (this *InterfaceInterfaceMap) Contains(key interface{}) bool
func (this *InterfaceInterfaceMap) Get(key interface{}) interface{}
func (this *InterfaceInterfaceMap) GetOrSet(key interface{}, value interface{}) interface{}
func (this *InterfaceInterfaceMap) GetOrSetFunc(key interface{}, f func() interface{}) interface{}
func (this *InterfaceInterfaceMap) GetOrSetFuncLock(key interface{}, f func() interface{}) interface{}
func (this *InterfaceInterfaceMap) IsEmpty() bool
func (this *InterfaceInterfaceMap) Iterator(f func(k interface{}, v interface{}) bool)
func (this *InterfaceInterfaceMap) Keys() []interface{}
func (this *InterfaceInterfaceMap) LockFunc(f func(m map[interface{}]interface{}))
func (this *InterfaceInterfaceMap) RLockFunc(f func(m map[interface{}]interface{}))
func (this *InterfaceInterfaceMap) Remove(key interface{}) interface{}
func (this *InterfaceInterfaceMap) Set(key interface{}, val interface{})
func (this *InterfaceInterfaceMap) SetIfNotExist(key interface{}, value interface{}) bool
func (this *InterfaceInterfaceMap) Size() int
func (this *InterfaceInterfaceMap) Values() []interface{}
type Map
func New(unsafe ...bool) *Map
type StringBoolMap
func NewStringBoolMap(unsafe ...bool) *StringBoolMap
func (this *StringBoolMap) BatchRemove(keys []string)
func (this *StringBoolMap) BatchSet(m map[string]bool)
func (this *StringBoolMap) Clear()
func (this *StringBoolMap) Clone() map[string]bool
func (this *StringBoolMap) Contains(key string) bool
func (this *StringBoolMap) Get(key string) bool
func (this *StringBoolMap) GetOrSet(key string, value bool) bool
func (this *StringBoolMap) GetOrSetFunc(key string, f func() bool) bool
func (this *StringBoolMap) GetOrSetFuncLock(key string, f func() bool) bool
func (this *StringBoolMap) IsEmpty() bool
func (this *StringBoolMap) Iterator(f func(k string, v bool) bool)
func (this *StringBoolMap) Keys() []string
func (this *StringBoolMap) LockFunc(f func(m map[string]bool))
func (this *StringBoolMap) RLockFunc(f func(m map[string]bool))
func (this *StringBoolMap) Remove(key string) bool
func (this *StringBoolMap) Set(key string, val bool)
func (this *StringBoolMap) SetIfNotExist(key string, value bool) bool
func (this *StringBoolMap) Size() int
type StringIntMap
func NewStringIntMap(unsafe ...bool) *StringIntMap
func (this *StringIntMap) BatchRemove(keys []string)
func (this *StringIntMap) BatchSet(m map[string]int)
func (this *StringIntMap) Clear()
func (this *StringIntMap) Clone() map[string]int
func (this *StringIntMap) Contains(key string) bool
func (this *StringIntMap) Get(key string) int
func (this *StringIntMap) GetOrSet(key string, value int) int
func (this *StringIntMap) GetOrSetFunc(key string, f func() int) int
func (this *StringIntMap) GetOrSetFuncLock(key string, f func() int) int
func (this *StringIntMap) IsEmpty() bool
func (this *StringIntMap) Iterator(f func(k string, v int) bool)
func (this *StringIntMap) Keys() []string
func (this *StringIntMap) LockFunc(f func(m map[string]int))
func (this *StringIntMap) RLockFunc(f func(m map[string]int))
func (this *StringIntMap) Remove(key string) int
func (this *StringIntMap) Set(key string, val int)
func (this *StringIntMap) SetIfNotExist(key string, value int) bool
func (this *StringIntMap) Size() int
func (this *StringIntMap) Values() []int
type StringInterfaceMap
func NewStringInterfaceMap(unsafe ...bool) *StringInterfaceMap
func (this *StringInterfaceMap) BatchRemove(keys []string)
func (this *StringInterfaceMap) BatchSet(m map[string]interface{})
func (this *StringInterfaceMap) Clear()
func (this *StringInterfaceMap) Clone() map[string]interface{}
func (this *StringInterfaceMap) Contains(key string) bool
func (this *StringInterfaceMap) Get(key string) interface{}
func (this *StringInterfaceMap) GetOrSet(key string, value interface{}) interface{}
func (this *StringInterfaceMap) GetOrSetFunc(key string, f func() interface{}) interface{}
func (this *StringInterfaceMap) GetOrSetFuncLock(key string, f func() interface{}) interface{}
func (this *StringInterfaceMap) IsEmpty() bool
func (this *StringInterfaceMap) Iterator(f func(k string, v interface{}) bool)
func (this *StringInterfaceMap) Keys() []string
func (this *StringInterfaceMap) LockFunc(f func(m map[string]interface{}))
func (this *StringInterfaceMap) RLockFunc(f func(m map[string]interface{}))
func (this *StringInterfaceMap) Remove(key string) interface{}
func (this *StringInterfaceMap) Set(key string, val interface{})
func (this *StringInterfaceMap) SetIfNotExist(key string, value interface{}) bool
func (this *StringInterfaceMap) Size() int
func (this *StringInterfaceMap) Values() []interface{}
type StringStringMap
func NewStringStringMap(unsafe ...bool) *StringStringMap
func (this *StringStringMap) BatchRemove(keys []string)
func (this *StringStringMap) BatchSet(m map[string]string)
func (this *StringStringMap) Clear()
func (this *StringStringMap) Clone() map[string]string
func (this *StringStringMap) Contains(key string) bool
func (this *StringStringMap) Get(key string) string
func (this *StringStringMap) GetOrSet(key string, value string) string
func (this *StringStringMap) GetOrSetFunc(key string, f func() string) string
func (this *StringStringMap) GetOrSetFuncLock(key string, f func() string) string
func (this *StringStringMap) IsEmpty() bool
func (this *StringStringMap) Iterator(f func(k string, v string) bool)
func (this *StringStringMap) Keys() []string
func (this *StringStringMap) LockFunc(f func(m map[string]string))
func (this *StringStringMap) RLockFunc(f func(m map[string]string))
func (this *StringStringMap) Remove(key string) string
func (this *StringStringMap) Set(key string, val string)
func (this *StringStringMap) SetIfNotExist(key string, value string) bool
func (this *StringStringMap) Size() int
func (this *StringStringMap) Values() []string
```


## 使用示例
Expand Down
15 changes: 3 additions & 12 deletions container/gpool/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,10 @@
import "github.com/gogf/gf/g/container/gpool"
```

**接口文档**[godoc.org/github.com/gogf/gf/g/container/gpool](https://godoc.org/github.com/gogf/gf/g/container/gpool)
**接口文档**

[godoc.org/github.com/gogf/gf/g/container/gpool](https://godoc.org/github.com/gogf/gf/g/container/gpool)

```go
type NewFunc func() (interface{}, error)
type ExpireFunc func(interface{})
type Pool
func New(expire int, newFunc NewFunc, expireFunc...ExpireFunc) *Pool
func (p *Pool) Close()
func (p *Pool) Get() (interface{}, error)
func (p *Pool) Put(value interface{})
func (p *Pool) SetExpireFunc(expireFunc func(interface{}))
func (p *Pool) Size() int
```
需要注意两点:
1. `New`方法的过期时间单位为`毫秒`
1. 对象`创建方法`(`newFunc NewFunc`)返回值包含一个`error`返回,当对象创建失败时可由该返回值反馈原因;
Expand Down
13 changes: 4 additions & 9 deletions container/gqueue/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,10 @@
import "github.com/gogf/gf/g/container/gqueue"
```

**接口文档**[godoc.org/github.com/gogf/gf/g/container/gqueue](https://godoc.org/github.com/gogf/gf/g/container/gqueue)
```go
type Queue
func New(limit ...int) *Queue
func (q *Queue) Close()
func (q *Queue) Pop() interface{}
func (q *Queue) Push(v interface{})
func (q *Queue) Size() int
```
**接口文档**

[godoc.org/github.com/gogf/gf/g/container/gqueue](https://godoc.org/github.com/gogf/gf/g/container/gqueue)


## 使用示例1,基本使用

Expand Down
25 changes: 3 additions & 22 deletions container/gring/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,11 @@
import "github.com/gogf/gf/g/container/gring"
```

**接口文档**[godoc.org/github.com/gogf/gf/g/container/gring](https://godoc.org/github.com/gogf/gf/g/container/gring)
**接口文档**

```go
type Ring
func New(cap int) *Ring
func (r *Ring) Cap() int
func (r *Ring) Len() int
func (r *Ring) Link(s *Ring) *Ring
func (r *Ring) LockIteratorNext(f func(item *ring.Ring) bool)
func (r *Ring) LockIteratorPrev(f func(item *ring.Ring) bool)
func (r *Ring) Move(n int) *Ring
func (r *Ring) Next() *Ring
func (r *Ring) Prev() *Ring
func (r *Ring) Put(value interface{}) *Ring
func (r *Ring) RLockIteratorNext(f func(value interface{}) bool)
func (r *Ring) RLockIteratorPrev(f func(value interface{}) bool)
func (r *Ring) Set(value interface{}) *Ring
func (r *Ring) SliceNext() []interface{}
func (r *Ring) SlicePrev() []interface{}
func (r *Ring) Unlink(n int) *Ring
func (r *Ring) Val() interface{}
```
[godoc.org/github.com/gogf/gf/g/container/gring](https://godoc.org/github.com/gogf/gf/g/container/gring)

从以上方法可以看出,`gring`支持链式操作。
`gring`支持链式操作。



Expand Down
49 changes: 4 additions & 45 deletions container/gset/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,11 @@
import "github.com/gogf/gf/g/container/gset"
```

**接口文档**[godoc.org/github.com/gogf/gf/g/container/gset](https://godoc.org/github.com/gogf/gf/g/container/gset)
```go
type Set
func New(unsafe ...bool) *Set
type IntSet
func NewIntSet(unsafe ...bool) *IntSet
func (this *IntSet) Add(item int) *IntSet
func (this *IntSet) BatchAdd(items []int) *IntSet
func (this *IntSet) Clear()
func (this *IntSet) Contains(item int) bool
func (this *IntSet) Iterator(f func(v int) bool)
func (this *IntSet) LockFunc(f func(map[int]struct{}))
func (this *IntSet) RLockFunc(f func(map[int]struct{}))
func (this *IntSet) Remove(key int)
func (this *IntSet) Size() int
func (this *IntSet) Slice() []int
func (this *IntSet) String() string
type InterfaceSet
func NewInterfaceSet(unsafe ...bool) *InterfaceSet
func (this *InterfaceSet) Add(item interface{}) *InterfaceSet
func (this *InterfaceSet) BatchAdd(items []interface{}) *InterfaceSet
func (this *InterfaceSet) Clear()
func (this *InterfaceSet) Contains(item interface{}) bool
func (this *InterfaceSet) Iterator(f func(v interface{}) bool)
func (this *InterfaceSet) LockFunc(f func(map[interface{}]struct{}))
func (this *InterfaceSet) RLockFunc(f func(map[interface{}]struct{}))
func (this *InterfaceSet) Remove(key interface{})
func (this *InterfaceSet) Size() int
func (this *InterfaceSet) Slice() []interface{}
func (this *InterfaceSet) String() string
type StringSet
func NewStringSet(unsafe ...bool) *StringSet
func (this *StringSet) Add(item string) *StringSet
func (this *StringSet) BatchAdd(items []string) *StringSet
func (this *StringSet) Clear()
func (this *StringSet) Contains(item string) bool
func (this *StringSet) Iterator(f func(v string) bool)
func (this *StringSet) LockFunc(f func(map[string]struct{}))
func (this *StringSet) RLockFunc(f func(map[string]struct{}))
func (this *StringSet) Remove(key string)
func (this *StringSet) Size() int
func (this *StringSet) Slice() []string
func (this *StringSet) String() string
```
**接口文档**
[godoc.org/github.com/gogf/gf/g/container/gset](https://godoc.org/github.com/gogf/gf/g/container/gset)


使用示例
## 使用示例
```go
package main

Expand Down
Loading

0 comments on commit ee17872

Please sign in to comment.