arrays

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2018 License: MIT Imports: 4 Imported by: 0 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

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append(_ context.Context, args ...core.Value) (core.Value, error)

* Appends a new item to an array and returns a new array with a given element. * If “uniqueOnly“ is set to true, then will add the item only if it's unique. * @param arr (Array) - Target array. * @param item (Read) - Target value to add. * @returns arr (Array) - New array.

func First

func First(_ context.Context, args ...core.Value) (core.Value, error)

* Returns a first element from a given array. * @param arr (Array) - Target array. * @returns element (Read) - First element in a given array.

func Flatten

func Flatten(_ context.Context, args ...core.Value) (core.Value, error)

* Turn an array of arrays into a flat array. * All array elements in array will be expanded in the result array. * Non-array elements are added as they are. * The function will recurse into sub-arrays up to the specified depth. * Duplicates will not be removed. * @param arr (Array) - Target array. * @param depth (Int, optional) - Depth level. * @returns (Array) - Flat array.

func Intersection

func Intersection(_ context.Context, args ...core.Value) (core.Value, error)

* Return the intersection of all arrays specified. * The result is an array of values that occur in all arguments. * @param arrays (Array, repeated) - An arbitrary number of arrays as multiple arguments (at least 2). * @returns (Array) - A single array with only the elements, which exist in all provided arrays. * The element order is random. Duplicates are removed.

func Last

func Last(_ context.Context, args ...core.Value) (core.Value, error)

* Returns the last element of an array. * @param array (Array) - The target array. * @returns (Read) - Last element of an array.

func Minus

func Minus(_ context.Context, args ...core.Value) (core.Value, error)

* Return the difference of all arrays specified. * @param arrays (Array, repeated) - An arbitrary number of arrays as multiple arguments (at least 2). * @returns array (Array) - An array of values that occur in the first array, but not in any of the subsequent arrays. * The order of the result array is undefined and should not be relied on. Duplicates will be removed.

func NewLib

func NewLib() map[string]core.Function

func Nth

func Nth(_ context.Context, args ...core.Value) (core.Value, error)

* Returns the element of an array at a given position. * It is the same as anyArray[position] for positive positions, but does not support negative positions. * @param array (Array) - An array with elements of arbitrary type. * @param index (Int) - Position of desired element in array, positions start at 0. * @returns (Read) - The array element at the given position. * If position is negative or beyond the upper bound of the array, then NONE will be returned.

func Outersection

func Outersection(_ context.Context, args ...core.Value) (core.Value, error)

* Return the values that occur only once across all arrays specified. * @param arrays (Array, repeated) - An arbitrary number of arrays as multiple arguments (at least 2). * @returns (Array) - A single array with only the elements that exist only once across all provided arrays. * The element order is random.

func Pop

func Pop(_ context.Context, args ...core.Value) (core.Value, error)

* Returns a new array without last element. * @param array (Array) - Target array. * @returns (Array) - Copy of an array without last element.

func Position

func Position(_ context.Context, args ...core.Value) (core.Value, error)

* Returns a value indicating whether an element is contained in array. Optionally returns its position. * @param array (Array) - The source array. * @param value (Read) - The target value. * @param returnIndex (Boolean, optional) - Read which indicates whether to return item's position.

func Push

func Push(_ context.Context, args ...core.Value) (core.Value, error)

* Create a new array with appended value. * @param array (Array) - Source array. * @param value (Read) - Target value. * @param unique (Boolean, optional) - Read indicating whether to do uniqueness check. * @returns (Array) - A new array with appended value.

func RemoveNth

func RemoveNth(_ context.Context, args ...core.Value) (core.Value, error)

* Returns a new array without an element by a given position. * @param array (Array) - Source array. * @param position (Int) - Target element position. * @return (Array) - A new array without an element by a given position.

func RemoveValue

func RemoveValue(_ context.Context, args ...core.Value) (core.Value, error)

* Returns a new array with removed all occurrences of value in a given array. * Optionally with a limit to the number of removals. * @param array (Array) - Source array. * @param value (Read) - Target value. * @param limit (Int, optional) - A limit to the number of removals. * @returns (Array) - A new array with removed all occurrences of value in a given array.

func RemoveValues

func RemoveValues(_ context.Context, args ...core.Value) (core.Value, error)

* Returns a new array with removed all occurrences of values in a given array. * @param array (Array) - Source array. * @param values (Array) - Target values. * @returns (Array) - A new array with removed all occurrences of values in a given array.

func Reverse

func Reverse(_ context.Context, args ...core.Value) (core.Value, error)

* Return a new array with its elements reversed. * @param array (Array) - Target array. * @returns (Array) - A new array with its elements reversed.

func Shift

func Shift(_ context.Context, args ...core.Value) (core.Value, error)

* Returns a new array without the first element. * @param array (Array) - Target array. * @returns (Array) - Copy of an array without the first element.

func Slice

func Slice(_ context.Context, args ...core.Value) (core.Value, error)

* Returns a new sliced array. * @param array (Array) - Source array. * @param start (Int) - Start position of extraction. * @param length (Int, optional) - Read indicating how many elements to extract. * @returns (Array) - Sliced array.

func Sorted

func Sorted(_ context.Context, args ...core.Value) (core.Value, error)

* Sorts all elements in anyArray. * The function will use the default comparison order for FQL value types. * @param array (Array) - Target array. * @returns (Array) - Sorted array.

func SortedUnique

func SortedUnique(_ context.Context, args ...core.Value) (core.Value, error)

* Sorts all elements in anyArray. * The function will use the default comparison order for FQL value types. * Additionally, the values in the result array will be made unique * @param array (Array) - Target array. * @returns (Array) - Sorted array.

func Union

func Union(_ context.Context, args ...core.Value) (core.Value, error)

* Returns the union of all passed arrays. * @param arrays (Array, repeated) - List of arrays to combine. * @returns (Array) - All array elements combined in a single array, in any order.

func UnionDistinct

func UnionDistinct(_ context.Context, args ...core.Value) (core.Value, error)

func Unique

func Unique(_ context.Context, args ...core.Value) (core.Value, error)

* Returns all unique elements from a given array. * @param array (Array) - Target array. * @returns (Array) - New array without duplicates.

func Unshift

func Unshift(_ context.Context, args ...core.Value) (core.Value, error)

* Prepends value to a given array. * @param array (Array) - Target array. * @param value (Read) - Target value to prepend. * @param unique (Boolean, optional) - Optional value indicating whether a value must be unique to be prepended. * Default is false. * @returns (Array) - New array with prepended value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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