Help us shape the future of Go! Take the 2026 Go Developer Survey

underscore

package module
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2018 License: MIT Imports: 9 Imported by: 0

README

                  /\ \                                                       
 __  __    ___    \_\ \     __   _ __   ____    ___    ___   _ __    __	         __     ___
/\ \/\ \ /' _ `\  /'_  \  /'__`\/\  __\/ ,__\  / ___\ / __`\/\  __\/'__`\      /'_ `\  / __`\
\ \ \_\ \/\ \/\ \/\ \ \ \/\  __/\ \ \//\__, `\/\ \__//\ \ \ \ \ \//\  __/  __ /\ \L\ \/\ \L\ \
 \ \____/\ \_\ \_\ \___,_\ \____\\ \_\\/\____/\ \____\ \____/\ \_\\ \____\/\_\\ \____ \ \____/
  \/___/  \/_/\/_/\/__,_ /\/____/ \/_/ \/___/  \/____/\/___/  \/_/ \/____/\/_/ \/___L\ \/___/
                                                                                 /\____/
                                                                                 \_/__/

Underscore.go

like underscore.js, but for Go

Installation

$ go get github.com/ahl5esoft/golang-underscore

Update

$ go get -u github.com/ahl5esoft/golang-underscore

Lack

* FindLastIndex
* Sample
* more...

Documentation

API
### All(source, predicate)

Arguments

  • source - array or map
  • predicate - func(element, index or key) bool

Return

  • bool - all the values that pass a truth test predicate

Examples

arr := []TestModel{
	TestModel{1, "one"},
	TestModel{1, "two"},
	TestModel{1, "three"},
}
ok := All(arr, func(r TestModel, _ int) bool {
	return r.Id == 1
})
// ok == true
### AllBy(source, properties)

Arguments

  • source - array or map
  • properties - map[string]interface{}

Return

  • bool

Examples

arr := []TestModel{
	TestModel{1, "one"},
	TestModel{1, "two"},
	TestModel{1, "three"},
}
ok := AllBy(arr, nil)
// ok == true

ok = AllBy(arr, map[string]interface{}{
	"name": "a",
})
// ok == false

ok = AllBy(arr, map[string]interface{}{
	"id": 1,
})
// ok == true
### Any(source, predicate)

Arguments

  • source - array or map
  • predicate - func(element or value, index or key) bool

Return

  • bool - any of the values that pass a truth test predicate

Examples

arr := []TestModel{
	TestModel{1, "one"},
	TestModel{2, "two"},
	TestModel{3, "three"},
}
ok := Any(arr, func(r TestModel, _ int) bool {
	return r.Id == 0
})
// ok == false
### AnyBy(source, properties)

Arguments

  • source - array or map
  • properties - map[string]interface{}

Return

  • bool

Examples

arr := []TestModel{
	TestModel{1, "one"},
	TestModel{2, "two"},
	TestModel{3, "three"},
}
ok := AnyBy(arr, map[string]interface{}{
	"Id": 0,
})
// ok == false

ok = AnyBy(arr, map[string]interface{}{
	"id":   arr[0].Id,
	"name": arr[0].Name,
})
// ok == true
### Chain(source).AsParallel()...

Support

  • Each
  • Object

Examples

arr := []int{ 1, 2, 3 }
Chain(arr).AsParallel().Each(func (n, i int) {
	// code
})
### Chain(source)

Arguments

  • source - array or map

Return

  • interface{} - a wrapped object, wrapped objects until value is called

Examples

res, ok := Chain([]int{1, 2, 1, 4, 1, 3}).Uniq(nil).Group(func(n, _ int) string {
	if n%2 == 0 {
		return "even"
	}

	return "old"
}).Value().(map[string][]int)
// len(res) == 2 && ok == true
### Clone()

Return

  • interface{}

Examples

arr := []int{1, 2, 3}
duplicate := Clone(arr)
ok := All(duplicate, func(n, i int) bool {
	return arr[i] == n
})
// ok == true
### Each(source, iterator)

Arguments

  • source - array or map
  • iterator - func(element or value, index or key)

Examples

arr := []TestModel{
	TestModel{1, "one"},
	TestModel{1, "two"},
	TestModel{1, "three"},
}
Each(arr, func (r TestModel, i int) {
	// coding
})
### Find(source, predicate)

Arguments

  • source - array or map
  • predicate - func(element or value, index or key) bool

Return

  • interface{}

Examples

arr := []TestModel{
	TestModel{1, "one"},
	TestModel{2, "two"},
	TestModel{3, "three"},
}
item := Find(arr, func(r TestModel, _ int) bool {
	return r.Id == 1
})
// item == arr[0]
### FindBy(source, properties)

Arguments

  • source - array or map
  • properties - map[string]interface{}

Return

  • interface{}

Examples

arr := []TestModel{
	TestModel{1, "one"},
	TestModel{2, "two"},
	TestModel{3, "three"},
}
item := FindBy(arr, map[string]interface{}{
	"id": 2,
})
// item == arr[1]
### FindIndex(source, predicate)

Arguments

  • source - array or map
  • predicate - func(element or value, index or key) bool

Return

  • int - index

Examples

arr := []TestModel{
	TestModel{1, "one"},
	TestModel{1, "two"},
	TestModel{1, "three"},
}
i := FindIndex(arr, func(r TestModel, _ int) bool {
	return r.Name == arr[1].Name
})
// i == 1
### FindIndexBy(source, properties)

Arguments

  • source - array or map
  • properties - map[string]interface{}

Return

  • int - index

Examples

arr := []TestModel{
	TestModel{1, "one"},
	TestModel{2, "two"},
	TestModel{3, "three"},
}
i := FindIndexBy(arr, map[string]interface{}{
	"id": 1,
})
// i == 0
### First(source)

Arguments

  • source - array or map

Return

  • interface{}

Examples

arr := []int{ 1, 2, 3 }
v := First(arr)
n, ok := v.(int)
if !(ok && n == 1) {
	//wrong
}

v = First(nil)
if v != nil {
	//wrong
}
### Group(source, keySelector)

Arguments

  • source - array or map
  • keySelector - func(element or value, index or key) anyType

Return

  • interface{} - map[anyType][](element or value)

Examples

v := Group([]int{ 1, 2, 3, 4, 5 }, func (n, _ int) string {
	if n % 2 == 0 {
		return "even"
	}
	return "odd"
})
dict, ok := v.(map[string][]int)
if !(ok && len(dict["even"]) == 2) {
	t.Error("wrong")
}
### GroupBy(source, property)

Arguments

  • source - array or map
  • property - property name

Return

  • interface{} - map[property type][](element or value)

Examples

arr := []TestModel{
	TestModel{ 1, "a" },
	TestModel{ 2, "a" },
	TestModel{ 3, "b" },
	TestModel{ 4, "b" },
}
v := GroupBy(arr, "name")
dict, ok := v.(map[string][]TestModel)
if !(ok && len(dict) == 2) {
	t.Error("wrong")
}
### Index(source, indexSelector)

Arguments

  • source - array or map
  • indexSelector - func(element or value, index or key) anyType

Return

  • interface{} - map[anyType](element or value)

Examples

v, _ := Index([]string{ "a", "b" }, func (item string, _ int) string {
	return item
})
res, ok := v.(map[string]string)
if !(ok && res["a"] == "a") {
	// wrong
}
### IndexBy(source, property)

Arguments

  • source - array or map
  • property - string

Return

  • interface{} - map[propertyType](element or value)

Examples

arr := []TestModel{
	TestModel{ 1, "a" },
	TestModel{ 2, "a" },
	TestModel{ 3, "b" },
	TestModel{ 4, "b" },
}
res := IndexBy(arr, "Name")
dict, ok := res.(map[string]TestModel)
if !(ok && len(dict) == 2) {
	// wrong
}
### IsArray(element)

Arguments

  • element - object

Return

  • bool

Examples

if !IsArray([]int{}) {
	// wrong
}

if IsArray(map[string]int{}) {
	// wrong
}
### IsMatch(element, properties)

Arguments

  • element - object
  • properties - map[string]interface{}

Return

  • bool

Examples

m := TestModel{ 1, "one" }
ok := IsMatch(nil, nil)
if ok {
	// wrong
}

ok = IsMatch(m, nil)
if ok {
	// wrong
}

ok = IsMatch(m, map[string]interface{}{
	"id": m.Id,
	"name": "a",
})
if ok {
	// wrong
}

ok = IsMatch(m, map[string]interface{}{
	"id": m.Id,
	"name": m.Name,
})
if !ok {
	// wrong
}
### Keys()

Arguments

  • source - map

Return

  • interface{} - []keyType

Examples

arr := []string{ "aa" }
v := Keys(arr)
if v != nil {
	// wrong
}

dict := map[int]string{	
	1: "a",
	2: "b",
	3: "c",
	4: "d",
}
v = Keys(dict)
res, ok := v.([]int)
if !(ok && len(res) == len(dict)) {
	// wrong
}
### Map(source, selector)

Arguments

  • source - array or map
  • selector - func(element, index or key) anyType

Return

  • interface{} - an array of anyType

Examples

arr := []string{ "11", "12", "13" }
v := Map(arr, func (s string, _ int) int {
	n, _ := strconv.Atoi(s)
	return n
})
res, ok := v.([]int)
if !(ok && len(res) == len(arr)) {
	// wrong
}
### Md5(plaintext)

Arguments

  • plaintext - string

Return

  • string - md5 string

Examples

if Md5("123456") != "e10adc3949ba59abbe56e057f20f883e" {
	// wrong
}	
### Object(arr)

Arguments

  • arr - array

Return

  • map, error

Examples

arr := []interface{}{
	[]interface{}{"a", 1},
	[]interface{}{"b", 2},
}
dic, ok := Object(arr).(map[string]int)
if !(ok && len(dic) == 2) {
	// wrong
}

if v1, ok := dic["a"]; !(ok && v1 == 1) {
	// wrong
}

if v1, ok := dic["b"]; !(ok && v1 == 2) {
	// wrong
}
### Pluck(source, property)

Arguments

  • source - array
  • property - string

Return

  • interface{} - an array of property type

Examples

arr := []TestModel{
	TestModel{ 1, "one" },
	TestModel{ 2, "two" },
	TestModel{ 3, "three" },
}
v := Pluck(arr, "name")
res, ok := v.([]string)
if !(ok && len(res) == len(arr)) {
	// wrong
}

for i := 0; i < 3; i++ {
	if res[i] != arr[i].Name {
		// wrong
	}
}
### Property(name)

Arguments

  • name - property name

Return

  • func(interface{}) (interface{}, error)

Examples

item := TestModel{ 1, "one" }

getAge := Property("age")
_, err := getAge(item)
if err == nil {
	// wrong
}

getName := Property("name")
name, err := getName(item)
if !(err == nil && name.(string) == item.Name) {
	// wrong
}
### Property(name)

Arguments

  • name - property name

Return

  • func(interface{}) (reflect.Value, error)

Examples

item := TestModel{ 1, "one" }

getAgeRV := PropertyRV("age")
_, err := getAgeRV(item)
if err == nil {
	// wrong
}

getNameRV := PropertyRV("name")
nameRV, err := getNameRV(item)
if !(err == nil && nameRV.String() == item.Name) {
	// wrong
}
### Range(start, stop, step)

Arguments

  • start - int
  • stop - int
  • step - int

Return

  • []int

Examples

arr := Range(0, 0, 1)
if len(arr) != 0 {
	// wrong
}

arr = Range(0, 10, 0)
if len(arr) != 0 {
	// wrong
}

arr = Range(10, 0, 1)
if len(arr) != 0 {
	// wrong
}

arr = Range(0, 2, 1)
if !(len(arr) == 2 && arr[0] == 0 && arr[1] == 1) {
	// wrong
}

arr = Range(0, 3, 2)
if !(len(arr) == 2 && arr[0] == 0 && arr[1] == 2) {
	// wrong
}
### Reduce(source, iterator)

Arguments

  • source - array
  • iterator - func(memo, element or value, key or index) memo
  • memo - anyType

Return

  • interface{} - memo

Examples

v := Reduce([]int{ 1, 2 }, func (memo []int, n, _ int) []int {
	memo = append(memo, n)
	memo = append(memo, n + 10)
	return memo
}, make([]int, 0))
res, ok := v.([]int)
if !(ok && len(res) == 4) {
	// wrong
}

if !(res[0] == 1 && res[1] == 11 && res[2] == 2 && res[3] == 12) {
	// wrong
}
### Reject(source, predicate)

Arguments

  • source - array or map
  • predicate - func(element or value, index or key) bool

Return

  • interface{} - an array of all the values that without pass a truth test predicate

Examples

arr := []int{ 1, 2, 3, 4 }
v := Reject(arr, func (n, i int) bool {
	return n % 2 == 0
})
res, ok := v.([]int)
if !(ok && len(res) == 2) {
	// wrong
}

if !(res[0] == 1 && res[1] == 3) {
	// wrong
}
### RejectBy(source, properties)

Arguments

  • source - array or map
  • properties - map[string]interface{}

Return

  • interface{} - an array of all the values that without pass a truth test properties

Examples

arr := []TestModel{
	TestModel{ 1, "one" },
	TestModel{ 2, "two" },
	TestModel{ 3, "three" },
}
v := RejectBy(arr, map[string]interface{}{
	"Id": 1,
})
res, ok := v.([]TestModel)
if !(ok && len(res) == 2) {
	// wrong
}
### Size(source)

Arguments

  • source - array or map

Return

  • int

Examples

dict := map[string]int{
	"a": 1,
	"b": 2,
	"c": 3,
}
if Size(dict) != len(dict) {
	// wrong
}
### Sort(source, selector)

Arguments

  • source - array or map
  • selector - func(element, key or index) anyType

Return

  • interface{} - an array of source that sorted

Examples

arr := []int{ 1, 2, 3, 5 }
v := Sort([]int{ 5, 3, 2, 1 }, func (n, _ int) int {
	return n
})
res, ok := v.([]int)
if !(ok && len(res) == len(arr)) {
	// wrong
}

for i, n := range arr {
	if res[i] != n {
		// wrong
	}
}
### SortBy(source, property)

Arguments

  • source - array or map
  • property - string

Return

  • interface{}

Examples

arr := []TestModel{
	TestModel{ 3, "three" },
	TestModel{ 1, "one" },
	TestModel{ 2, "two" },
}
v := SortBy(arr, "id")
res, ok := v.([]TestModel)
if !(ok && len(res) == len(arr)) {
	// wrong
}

if !(res[0].Id < res[1].Id && res[1].Id < res[2].Id) {
	// wrong
}
### Take(source, count)

Arguments

  • source - array or map
  • count - int

Return

  • interface{}

Examples

arr := []int{ 1, 2, 3 }
v := Take(arr, 1)
res, ok := v.([]int)
if !ok {
	// wrong
}

if res[0] != 1 {
	// wrong
}
### Uniq(source, selector)

Arguments

  • source - array
  • selector - nil or func(element or value, index or key) anyType

Return

  • interface{} - only the first occurence of each value is kept

Examples

v := Uniq([]int{ 1, 2, 1, 4, 1, 3 }, func (n, _ int) int {
	return n % 2
})
res, ok := v.([]int)
if !(ok && len(res) == 2) {
	// wrong
}
### UniqBy(source, property)

Arguments

  • source - array
  • property - string

Return

  • interface{}

Examples

arr := []TestModel{
	TestModel{ 1, "one" },
	TestModel{ 2, "one" },
	TestModel{ 3, "one" },
}
v := UniqBy(arr, "Name")
res, ok := v.([]TestModel)
if !(ok && len(res) == 1) {
	// wrong
}
### UUID()

Return

  • string - uuid string

Examples

uuid := UUID()
//1a40272540e57d1c80e7b06042219d0c
### Values(source)

Arguments

  • source - map

Return

  • interface{} - an array of source's values
  • error

Examples

dict := map[int]string{	
	1: "a",
	2: "b",
	3: "c",
	4: "d",
}
v, _ := Values(dict)
res, ok := v.([]string)
if !(ok && len(res) == len(dict)) {
	// wrong
}

<a name="where" />
### Where(source, predicate)

__Arguments__

* `source` - array or map
* `predicate` - func(element or value, index or key) bool

__Return__

* interface{} - an array of all the values that pass a truth test `predicate`

__Examples__

```go
arr := []TestModel{
	TestModel{1, "one"},
	TestModel{2, "two"},
	TestModel{3, "three"},
	TestModel{4, "three"},
}
v := Where(arr, func(r TestModel, i int) bool {
	return r.Id%2 == 0
})
res, ok := v.([]TestModel)
if !(ok && len(res) == 2) {
	// wrong
}

if !(res[0].Id == 2 && res[1].Id == 4) {
	// wrong
}
### WhereBy(source, properties)

Arguments

  • source - array or map
  • properties - map[string]interface{}

Return

  • interface{} - an array of all the values that pass a truth test properties

Examples

arr := []TestModel{
	TestModel{1, "one"},
	TestModel{2, "one"},
	TestModel{3, "three"},
	TestModel{4, "three"},
}
v := WhereBy(arr, map[string]interface{}{
	"Name": "one",
})
res, ok := v.([]TestModel)
if !(ok && len(res) == 2 && res[0] == arr[0] && res[1] == arr[1]) {
	// wrong
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorRt is 错误类型
	ErrorRt = reflect.TypeOf(errors.New(""))
	// FacadeRt is 门面类型
	FacadeRt = reflect.TypeOf(Facade{})
	// NullRv is 反射值
	NullRv = reflect.ValueOf(nil)
	// NullRvOfRt is nil反射值类型
	NullRvOfRt = reflect.TypeOf(NullRv)
)

Functions

func All

func All(source, predicate interface{}) bool

All of the values in the `source` pass the `predicate` truth test @source map or array @predicate func(value or item, key or index) bool

func AllBy

func AllBy(source interface{}, properties map[string]interface{}) bool

AllBy will stop traversing the `source` if a false element is found @source map or array @properties map[string]interface{}

func Any

func Any(source, predicate interface{}) bool

Any is if any of the values in the `source` pass the `predicate` truth test @source map or array @predicate func(value or item, key or index) bool

func AnyBy

func AnyBy(source interface{}, properties map[string]interface{}) bool

AnyBy will stop traversing the `source` if a true element is found @source map or array

func Clone

func Clone(source interface{}) interface{}

Clone will create a deep-copied clone of the `source`

func Each

func Each(source, iterator interface{})

Each will iterate over a list of elements @source map or array @iterator func(value or item, key or index) bool

func Find

func Find(source, predicate interface{}) interface{}

Find is 根据断言获取元素

func FindBy

func FindBy(source interface{}, properties map[string]interface{}) interface{}

FindBy is 根据属性值获取元素

func FindIndex

func FindIndex(source, predicate interface{}) int

FindIndex is 根据断言函数获取下标

func FindIndexBy

func FindIndexBy(source interface{}, properties map[string]interface{}) int

FindIndexBy is 根据字典获取下标

func First

func First(source interface{}) interface{}

First is 获取第一个元素

func Group

func Group(source, keySelector interface{}) interface{}

Group is 分组

func GroupBy

func GroupBy(source interface{}, property string) interface{}

GroupBy is 根据某个属性分组

func Index

func Index(source, indexSelector interface{}) interface{}

Index is 转化为indexSelector筛选出的值为key的map

func IndexBy

func IndexBy(source interface{}, property string) interface{}

IndexBy is 转化为property值的map

func IsArray

func IsArray(v interface{}) bool

IsArray is 判断是否数组或者切片

func IsMatch

func IsMatch(item interface{}, properties map[string]interface{}) bool

IsMatch is 对象中的属性名与属性值都与map的key和value相同

func Keys

func Keys(source interface{}) interface{}

Keys is 获取map的所有key

func Last

func Last(source interface{}) interface{}

Last is 最后元素

func Map

func Map(source, selector interface{}) interface{}

Map 映射

func Md5

func Md5(plaintext string) string

Md5 is 字符串转md5

func Object

func Object(source interface{}) interface{}

Object 将二维数组转化为字典

func Pluck

func Pluck(source interface{}, property string) interface{}

Pluck is 从source中取出所有property

func Property

func Property(name string) func(interface{}) (interface{}, error)

Property is 获取属性函数

func PropertyRV

func PropertyRV(name string) func(interface{}) (reflect.Value, error)

PropertyRV is 获取reflect.Value

func Range

func Range(start, stop, step int) []int

Range is 生成区间数据

func Reduce

func Reduce(source, iterator, memo interface{}) interface{}

Reduce is 聚合

func Reject

func Reject(source, predicate interface{}) interface{}

Reject is 排除

func RejectBy

func RejectBy(source interface{}, properties map[string]interface{}) interface{}

RejectBy is 根据属性排除

func Size

func Size(source interface{}) int

Size is 数组或字典的长度

func Sort

func Sort(source, selector interface{}) interface{}

Sort is 排序

func SortBy

func SortBy(source interface{}, property string) interface{}

SortBy is 根据属性排序

func Take

func Take(source interface{}, count int) interface{}

Take is 获取从0开始的n个元素

func ToRealValue

func ToRealValue(rv reflect.Value) interface{}

ToRealValue is 将反射值转为真实类型的值

func UUID

func UUID() string

UUID is 生成UUID

func Uniq

func Uniq(source, selector interface{}) interface{}

Uniq is 去重

func UniqBy

func UniqBy(source interface{}, property string) interface{}

UniqBy is 根据某个属性去重

func Values

func Values(source interface{}) interface{}

Values is 字典的所有value

func Where

func Where(source, predicate interface{}) interface{}

Where is 获取所有满足条件

func WhereBy

func WhereBy(source interface{}, properties map[string]interface{}) interface{}

WhereBy is 获取所有满足条件

Types

type Facade

type Facade struct {
	Real reflect.Value
}

Facade is 包装真实的值 each的时候 如果iterator返回Facade 则会将Real替换iterator返回值

type IQuery

type IQuery interface {
	All(interface{}) IQuery
	AllBy(map[string]interface{}) IQuery
	Any(interface{}) IQuery
	AnyBy(map[string]interface{}) IQuery
	AsParallel() IQuery
	Clone() IQuery
	Each(interface{}) IQuery
	Find(interface{}) IQuery
	FindBy(map[string]interface{}) IQuery
	FindIndex(interface{}) IQuery
	FindIndexBy(map[string]interface{}) IQuery
	First() IQuery
	Group(interface{}) IQuery
	GroupBy(string) IQuery
	Index(interface{}) IQuery
	IndexBy(string) IQuery
	Keys() IQuery
	Last() IQuery
	Map(interface{}) IQuery
	Object() IQuery
	Pluck(string) IQuery
	Range(int, int, int) IQuery
	Reduce(interface{}, interface{}) IQuery
	Reject(interface{}) IQuery
	RejectBy(map[string]interface{}) IQuery
	Size() IQuery
	Sort(interface{}) IQuery
	SortBy(string) IQuery
	Take(int) IQuery
	Uniq(interface{}) IQuery
	UniqBy(string) IQuery
	Value() interface{}
	Values() IQuery
	Where(interface{}) IQuery
	WhereBy(map[string]interface{}) IQuery
}

IQuery is interface

func Chain

func Chain(source interface{}) IQuery

Chain will cause all future method calls to return wrapped objects

type Query

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

Query is a wrapper

func (*Query) All

func (q *Query) All(predicate interface{}) IQuery

All is IQuery's method

func (*Query) AllBy

func (q *Query) AllBy(properties map[string]interface{}) IQuery

AllBy is IQuery's method

func (*Query) Any

func (q *Query) Any(predicate interface{}) IQuery

Any is IQuery's method

func (*Query) AnyBy

func (q *Query) AnyBy(properties map[string]interface{}) IQuery

AnyBy is IQuery's method

func (*Query) AsParallel

func (q *Query) AsParallel() IQuery

AsParallel will turn on parallel

func (*Query) Clone

func (q *Query) Clone() IQuery

Clone is IQuery's method

func (*Query) Each

func (q *Query) Each(iterator interface{}) IQuery

Each is IQuery's method

func (*Query) Find

func (q *Query) Find(predicate interface{}) IQuery

Find is IQuery's method

func (*Query) FindBy

func (q *Query) FindBy(properties map[string]interface{}) IQuery

FindBy is IQuery's method

func (*Query) FindIndex

func (q *Query) FindIndex(predicate interface{}) IQuery

FindIndex is IQuery's method

func (*Query) FindIndexBy

func (q *Query) FindIndexBy(properties map[string]interface{}) IQuery

FindIndexBy is IQuery's method

func (*Query) First

func (q *Query) First() IQuery

First is IQuery's method

func (*Query) Group

func (q *Query) Group(keySelector interface{}) IQuery

Group is IQuery's mehtod

func (*Query) GroupBy

func (q *Query) GroupBy(property string) IQuery

GroupBy is IQuery's mehtod

func (*Query) Index

func (q *Query) Index(indexSelector interface{}) IQuery

Index is IQuery's method

func (*Query) IndexBy

func (q *Query) IndexBy(property string) IQuery

IndexBy is IQuery's method

func (*Query) Keys

func (q *Query) Keys() IQuery

Keys is IQuery's method

func (*Query) Last

func (q *Query) Last() IQuery

Last is IQuery's method

func (*Query) Map

func (q *Query) Map(selector interface{}) IQuery

Map is IQuery's method

func (*Query) Object

func (m *Query) Object() IQuery

Object is IQuery'e method

func (*Query) Pluck

func (q *Query) Pluck(property string) IQuery

Pluck is IQuery's method

func (*Query) Range

func (q *Query) Range(start, stop, step int) IQuery

Range is IQuery's method

func (*Query) Reduce

func (q *Query) Reduce(iterator, memo interface{}) IQuery

Reduce is IQuery's method

func (*Query) Reject

func (q *Query) Reject(predicate interface{}) IQuery

Reject is IQuery's Method

func (*Query) RejectBy

func (q *Query) RejectBy(properties map[string]interface{}) IQuery

RejectBy is IQuery's Method

func (*Query) Size

func (q *Query) Size() IQuery

Size is IQuery's Method

func (*Query) Sort

func (q *Query) Sort(selector interface{}) IQuery

Sort is IQuery's method

func (*Query) SortBy

func (q *Query) SortBy(property string) IQuery

SortBy is IQuery's method

func (*Query) Take

func (q *Query) Take(count int) IQuery

Take is Query's method

func (*Query) Uniq

func (q *Query) Uniq(selector interface{}) IQuery

Uniq is IQuery's method

func (*Query) UniqBy

func (q *Query) UniqBy(property string) IQuery

UniqBy is IQuery's method

func (*Query) Value

func (q *Query) Value() interface{}

Value will return final result

func (*Query) Values

func (q *Query) Values() IQuery

Values is IQuery's method

func (*Query) Where

func (q *Query) Where(predicate interface{}) IQuery

Where is IQuery's method

func (*Query) WhereBy

func (q *Query) WhereBy(properties map[string]interface{}) IQuery

WhereBy is IQuery's method

Jump to

Keyboard shortcuts

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