Collection

Collection is the basic structrue for values in a Task

New

Description:

// Create a new collection
func NewCollection() *Collection

Usage:

// create a new collection
col := task.NewCollection()

Append

Description:

// Append values to the collection
func (col *Collection) Append(cs ...interface{}) *Collection

Usage:

col := task.Collection{}
col.Append(1,"2",true)

Filter

Description:

// Return a copy of the collection after filtering
func (col *Collection) Filter(f func(interface{}) bool) *Collection

Usage:

col := task.Collection{1,2,3}
fmt.Println(col.Filter(func(v interface{})) bool {return v.(int) > 1}))    // [2,3]

IsEmpty

Description:

// Return if the collection is empty
func (col *Collection) IsEmpty() bool

Usage:

col := task.Collection{}
fmt.Println(col.IsEmpty())    // true

Length

Description:

// Return the length of the collection
func (col *Collection) Length() int

Usage:

col := task.Collection{}
fmt.Println(col.Length())    // 0



results matching ""

    No results matching ""