functions

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package functions provides custom importable functions for Expr runtimes that may be injected into your Expr runtime environments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSorted

func IsSorted() expr.Option

IsSorted provides the isSorted function as an Expr function. It will verify that the provided type is sorted ascending. It supports the following types: - Injected types that support the sort.Interface - []int - []float64 - []string

Usage:

// Inject into your environment.
_, err := expr.Compile(`foo`, expr.Env(nil), functions.ExprIsSorted())

Expression:

isSorted([1, 2, 3])
isSorted(["a", "b", "c"])
isSorted([1.0, 2.0, 3.0])
isSorted(myCustomType) // myCustomType must implement sort.Interface

Types

This section is empty.

Jump to

Keyboard shortcuts

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