gf

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2019 License: Apache-2.0 Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const VERSION = "0.0.3"

VERSION contains the current version of this library

Variables

This section is empty.

Functions

This section is empty.

Types

type IntC

type IntC []int

IntC is a Collection of Int values

func NewInt

func NewInt(values ...int) (result IntC)

NewInt - Takes a bunch of int-values and creates an IntC out of it.

func (IntC) All

func (ic IntC) All(iteratee func(int, int, IntC) bool) bool

All - Takes a validation function. It calls the validaton function with all values and returns true if all calls returned "true". However, it will stop the moment the validation function returns "false".

func (IntC) Any

func (ic IntC) Any(iteratee func(int, int, IntC) bool) bool

Any - Similar to "All" and "None". But it will return "true" when at least one value returns "true".

func (IntC) Asc

func (ic IntC) Asc() IntC

Asc - Sorts the slice in ascending order.

func (IntC) Avg

func (ic IntC) Avg() int

Avg - Creates the average value of the slice and returns it.

func (IntC) Concat

func (ic IntC) Concat(collections ...IntC) IntC

Concat - Adds one or more collections at the end of the collection.

func (IntC) Contains

func (ic IntC) Contains(value int, from int, to int) bool

Contains - Checks if the slice contains a specific value. An offset and an endpoint can be present to constrain the search even further. If the values -1 are used for "from" and "to" they will fall back to their default values. from = 0; to = len(ic)

func (IntC) Desc

func (ic IntC) Desc() IntC

Desc - Sorts the slice in descending order.

func (IntC) Each

func (ic IntC) Each(iteratee func(int, int, IntC))

Each - Calls a function with every item in the slice.

func (IntC) Filter

func (ic IntC) Filter(iteratee func(int, int, IntC) bool) IntC

Filter - Takes a validation function. This validation function checks if a given value is fullfilling all requirements. The result of this function contains only values where the validation function returns "true".

func (IntC) Head

func (ic IntC) Head() (int, error)

Head - Returns the first entry of a slice.

func (IntC) IsAscSorted

func (ic IntC) IsAscSorted() bool

IsAscSorted - Checks if the slice is sorted in ascending order.

func (IntC) IsDescSorted

func (ic IntC) IsDescSorted() bool

IsDescSorted - Checks if the slice is sorted in descending order.

func (IntC) IsSorted

func (ic IntC) IsSorted() bool

IsSorted - Checks if the slice is order in ascending or descending order.

func (IntC) Map

func (ic IntC) Map(iteratee func(int, int, IntC) int) IntC

Map - Takes a transform function. This transform function will be called with all values in the slice. A new slice will be generated with the new generated values.

func (IntC) Max

func (ic IntC) Max(from int, to int) int

Max - finds the max value in the slice. A "from" and "to" can be specified to constrain the search even further.

func (IntC) Min

func (ic IntC) Min(from int, to int) int

Min - finds the min value in the slice. A "from" and "to" can be specified to constrain the search even further.

func (IntC) None

func (ic IntC) None(iteratee func(int, int, IntC) bool) bool

None - The opposite of "All"

func (IntC) Partition

func (ic IntC) Partition(iteratee func(int, int, IntC) bool) (Left IntC, Right IntC)

Partition - Takes a validaton function. It calls the the validaton function and creates two new slices based on the result. If the validaton function returns "true", it gets placed into the first slice. Otherwise it's in the second slice.

func (IntC) Push

func (ic IntC) Push(values ...int) IntC

Push - Adds one or more values at the end of the slice.

func (IntC) PushUnique

func (ic IntC) PushUnique(values ...int) IntC

PushUnique - Adds one or more values at the end of the slice if they're unique

func (IntC) Reduce added in v0.0.3

func (ic IntC) Reduce(reducer func(int, int, int, IntC) int, initialValue int) int

Reduce - Combines all entries in the collection based on a reducer method.

func (IntC) Reject

func (ic IntC) Reject(iteratee func(int, int, IntC) bool) IntC

Reject - Similar to Filter. The difference is, that only values will be added where the validaton function returns "false".

func (IntC) Remove

func (ic IntC) Remove(values ...int) IntC

Remove - A simple way to remove specific values from the slice.

func (IntC) Reverse

func (ic IntC) Reverse() IntC

Reverse - Returns the collection in reverse order.

func (IntC) Sum

func (ic IntC) Sum() int

Sum - Sums all values in the slice and returns it.

func (IntC) Tail

func (ic IntC) Tail() IntC

Tail - Returns a new slice without the first item.

func (IntC) Unique

func (ic IntC) Unique() IntC

Unique - Removes all duplicate values.

type StringC

type StringC []string

StringC is a Collection of String Values

func NewString

func NewString(values ...string) (result StringC)

NewString - Takes a bunch of string-values and creates a StringC out of it.

func (StringC) All

func (sc StringC) All(iteratee func(string, int, StringC) bool) bool

All - Takes a validation function. It calls the validaton function with all values and returns true if all calls returned "true". However, it will stop the moment the validation function returns "false".

func (StringC) Any

func (sc StringC) Any(iteratee func(string, int, StringC) bool) bool

Any - Similar to "All" and "None". But it will return "true" when at least one value returns "true".

func (StringC) Asc

func (sc StringC) Asc() StringC

Asc - Sorts the slice in ascending order.

func (StringC) Contains

func (sc StringC) Contains(value string, from int, to int) bool

Contains - Checks if the slice contains a specific value. An offset and an endpoint can be present to constrain the search even further. If the values -1 are used for "from" and "to" they will fall back to their default values. from = 0; to = len(ic)

func (StringC) Desc

func (sc StringC) Desc() StringC

Desc - Sorts the slice in descending order.

func (StringC) Each

func (sc StringC) Each(iteratee func(string, int, StringC))

Each - Calls a function with every item in the slice.

func (StringC) Filter

func (sc StringC) Filter(iteratee func(string, int, StringC) bool) StringC

Filter - Takes a validation function. This validation function checks if a given value is fullfilling all requirements. The result of this function contains only values where the validation function returns "true".

func (StringC) Head

func (sc StringC) Head() (string, error)

Head - Returns the first entry of a slice.

func (StringC) IsAscSorted

func (sc StringC) IsAscSorted() bool

IsAscSorted - Checks if the slice is sorted in ascending order.

func (StringC) IsDescSorted

func (sc StringC) IsDescSorted() bool

IsDescSorted - Checks if the slice is sorted in descending order.

func (StringC) IsSorted

func (sc StringC) IsSorted() bool

IsSorted - Checks if the slice is order in ascending or descending order.

func (StringC) Join added in v0.0.3

func (sc StringC) Join(sep string) string

Join - Joins all entries in a collection to a single string, seperated by a seperator.

func (StringC) Map

func (sc StringC) Map(iteratee func(string, int, StringC) string) StringC

Map - Takes a transform function. This transform function will be called with all values in the slice. A new slice will be generated with the new generated values.

func (StringC) Max

func (sc StringC) Max(from int, to int) string

Max - finds the max value in the slice. A "from" and "to" can be specified to constrain the search even further.

func (StringC) Min

func (sc StringC) Min(from int, to int) string

Min - finds the min value in the slice. A "from" and "to" can be specified to constrain the search even further.

func (StringC) None

func (sc StringC) None(iteratee func(string, int, StringC) bool) bool

None - The opposite of "All"

func (StringC) Partition

func (sc StringC) Partition(iteratee func(string, int, StringC) bool) (Left StringC, Right StringC)

Partition - Takes a validaton function. It calls the the validaton function and creates two new slices based on the result. If the validaton function returns "true", it gets placed into the first slice. Otherwise it's in the second slice.

func (StringC) Push

func (sc StringC) Push(values ...string) StringC

Push - Adds one or more values at the end of the slice.

func (StringC) PushUnique

func (sc StringC) PushUnique(values ...string) StringC

PushUnique - Adds one or more values at the end of the slice if they're unique

func (StringC) Reduce added in v0.0.3

func (sc StringC) Reduce(reducer func(string, string, int, StringC) string, initialValue string) string

Reduce - Combines all entries in the collection based on a reducer method.

func (StringC) Reject

func (sc StringC) Reject(iteratee func(string, int, StringC) bool) StringC

Reject - Similar to Filter. The difference is, that only values will be added where the validaton function returns "false".

func (StringC) Remove

func (sc StringC) Remove(values ...string) StringC

Remove - A simple way to remove specific values from the slice.

func (StringC) Tail

func (sc StringC) Tail() StringC

Tail - Returns a new slice without the first item.

func (StringC) Unique

func (sc StringC) Unique() StringC

Unique - Removes all duplicate values.

Jump to

Keyboard shortcuts

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