Show / Hide Table of Contents

Class Function

A class for creating IExpression instances that represent functions

Inheritance
System.Object
Function
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Couchbase.Lite.Query
Assembly: Couchbase.Lite.dll
Syntax
public static class Function

Methods

| Improve this Doc View Source

Abs(IExpression)

Creates a function that will get the absolute value of the expression in question

Declaration
public static IExpression Abs(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that will get the absolute value of the expression in question

| Improve this Doc View Source

Acos(IExpression)

Creates a function that will get the inverse cosine of the expression in question

Declaration
public static IExpression Acos(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that will get the inverse cosine of the expression in question

| Improve this Doc View Source

Asin(IExpression)

Creates a function that will get the inverse sin of the expression in question

Declaration
public static IExpression Asin(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that will get the inverse sin of the expression in question

| Improve this Doc View Source

Atan(IExpression)

Creates a function that will get the inverse tangent of the expression in question

Declaration
public static IExpression Atan(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that will get the inverse tangent of the expression in question

| Improve this Doc View Source

Atan2(IExpression, IExpression)

Creates a function that will get the arctangent of the point expressed by expressions calculating X and Y of the point for the formula

Declaration
public static IExpression Atan2(IExpression expressionY, IExpression expressionX)
Parameters
Type Name Description
IExpression expressionY

An expression or literal to evaluate to get the Y coordinate to use

IExpression expressionX

An expression or literal to evaluate to get the X coordinate to use

Returns
Type Description
IExpression

A function that will get the arctangent of the point in question

| Improve this Doc View Source

Avg(IExpression)

Creates a function that will calculate the average of the expression in question across the results in a particular query

Declaration
public static IExpression Avg(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that will calculate the average

| Improve this Doc View Source

Ceil(IExpression)

Creates a function that will get the ceiling value of the expression in question

Declaration
public static IExpression Ceil(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that will get the ceiling value of the expression in question

| Improve this Doc View Source

Contains(IExpression, IExpression)

Creates a function that will calculate if a given string is inside of another in question

Declaration
public static IExpression Contains(IExpression expression, IExpression substring)
Parameters
Type Name Description
IExpression expression

The string or expression that evaluates to a string to search

IExpression substring

The string or expression that evaluates to a string to search for

Returns
Type Description
IExpression

A function that will return true if the string contains the other, or false if it does not

| Improve this Doc View Source

Cos(IExpression)

Creates a function that will get the cosine of the expression in question

Declaration
public static IExpression Cos(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that will get the cosine of the expression in question

| Improve this Doc View Source

CosineDistance(IExpression, IExpression)

Creates a function that returns the cosine distance between two vectors of the same length. The result of the calculation is a floating-point number in the range [-1 ... +1] or null.

Declaration
public static IExpression CosineDistance(IExpression expression1, IExpression expression2)
Parameters
Type Name Description
IExpression expression1

The first input vector

IExpression expression2

The second input vector

Returns
Type Description
IExpression

An expression that can be further acted upon in the QueryBuilder

Remarks

NOTE: This is an enterprise edition feature

| Improve this Doc View Source

Count(IExpression)

Creates a function that will count the occurrences of expression in question across the results in a particular query

Declaration
public static IExpression Count(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that will calculate the count

| Improve this Doc View Source

Degrees(IExpression)

Creates a function that will convert a numeric expression to degrees from radians in question

Declaration
public static IExpression Degrees(IExpression expression)
Parameters
Type Name Description
IExpression expression

The numeric expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that will get the value of the expression in question expressed in degrees

| Improve this Doc View Source

E()

Creates a function that will return the value of the mathemetical constant 'e'

Declaration
public static IExpression E()
Returns
Type Description
IExpression

The value of 'e'

| Improve this Doc View Source

EuclideanDistance(IExpression, IExpression)

Creates a function that returns the euclidean distance between two vectors of the same length. The result of the calculation is a positive floating-point number or null.

Declaration
public static IExpression EuclideanDistance(IExpression expression1, IExpression expression2)
Parameters
Type Name Description
IExpression expression1

The first input vector

IExpression expression2

The second input vector

Returns
Type Description
IExpression

An expression that can be further acted upon in the QueryBuilder

Remarks

NOTE: This is an enterprise edition feature

| Improve this Doc View Source

Exp(IExpression)

Returns the mathematical constant 'e' raised to the given power

Declaration
public static IExpression Exp(IExpression expression)
Parameters
Type Name Description
IExpression expression

The numerical expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that will get the mathematical constant 'e' raised to the given power

| Improve this Doc View Source

Floor(IExpression)

Creates a function that will get the floor value of the expression in question

Declaration
public static IExpression Floor(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that will get the floor value of the expression in question

| Improve this Doc View Source

Length(IExpression)

Creates a function that gets the length of a string in question

Declaration
public static IExpression Length(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result (must be or evaluate to a string)

Returns
Type Description
IExpression

The length of the string in question

| Improve this Doc View Source

Ln(IExpression)

Creates a function that gets the natural log of the numerical expression

Declaration
public static IExpression Ln(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that gets the natural log of the expression

| Improve this Doc View Source

Log(IExpression)

Creates a function that gets the base 10 log of the numerical expression

Declaration
public static IExpression Log(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that gets the base 10 log of the expression

| Improve this Doc View Source

Lower(IExpression)

Creates a function that converts a string to lower case

Declaration
public static IExpression Lower(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that converts a string to lower case

| Improve this Doc View Source

Ltrim(IExpression)

Creates a function that removes whitespace from the beginning of a string

Declaration
public static IExpression Ltrim(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that removes whitespace from the beginning of a string

| Improve this Doc View Source

Max(IExpression)

Creates a function that will calculate the max value of the expression in question across the results in a particular query

Declaration
public static IExpression Max(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that will calculate the max value

| Improve this Doc View Source

MillisToString(IExpression)

Creates a function that will convert a numeric input representing milliseconds since the Unix epoch into a full ISO8601 date and time string in the device local time zone.

Declaration
public static IExpression MillisToString(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when converting

Returns
Type Description
IExpression

A function that will convert the timestamp to a string

| Improve this Doc View Source

MillisToUTC(IExpression)

Creates a function that will convert a numeric input representing milliseconds since the Unix epoch into a full ISO8601 date and time string in UTC time.

Declaration
public static IExpression MillisToUTC(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when converting

Returns
Type Description
IExpression

A function that will convert the timestamp to a string

| Improve this Doc View Source

Min(IExpression)

Creates a function that will calculate the min value of the expression in question across the results in a particular query

Declaration
public static IExpression Min(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that will calculate the min value

| Improve this Doc View Source

Pi()

Creates a function that will return the value of the mathemetical constant 'π'

Declaration
public static IExpression Pi()
Returns
Type Description
IExpression

The value of 'π'

| Improve this Doc View Source

Power(IExpression, IExpression)

Creates a function that will raise the given numeric expression to an expression that determines the exponent

Declaration
public static IExpression Power(IExpression b, IExpression exponent)
Parameters
Type Name Description
IExpression b

A numeric literal or expression that provides the base

IExpression exponent

A numeric literal or expression that provides the exponent

Returns
Type Description
IExpression

A function that will raise the base to the given exponent

| Improve this Doc View Source

Prediction(String, IExpression)

Creates a function that will invoke IPredictiveModel implementations to aid in machine learning predictive queries

Declaration
public static IPredictionFunction Prediction(string modelName, IExpression input)
Parameters
Type Name Description
System.String modelName

The model (registered via RegisterModel(String, IPredictiveModel)) to use when performing the prediction

IExpression input

The input to feed to the model. This can be either an expression that is evaluated into a dictionary or a dictionary literal expression.

Returns
Type Description
IPredictionFunction
Remarks

NOTE: This is an enterprise edition feature

| Improve this Doc View Source

Radians(IExpression)

Creates a function that will convert a numeric expression to radians from degrees in question

Declaration
public static IExpression Radians(IExpression expression)
Parameters
Type Name Description
IExpression expression

The numeric expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that will get the value of the expression in question expressed in radians

| Improve this Doc View Source

Round(IExpression)

Creates a function that will round the given expression in question

Declaration
public static IExpression Round(IExpression expression)
Parameters
Type Name Description
IExpression expression

The numeric expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that will round the expression (using midpoint rounding)

| Improve this Doc View Source

Round(IExpression, IExpression)

Creates a function that will round the given expression to the number of digits indicated in question

Declaration
public static IExpression Round(IExpression expression, IExpression digits)
Parameters
Type Name Description
IExpression expression

The numeric expression to take data from when calculating the result

IExpression digits

The number of digits to round to

Returns
Type Description
IExpression

A function that will round the expression (using midpoint rounding)

| Improve this Doc View Source

Rtrim(IExpression)

Creates a function that removes whitespace from the end of a string

Declaration
public static IExpression Rtrim(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that removes whitespace from the end of a string

| Improve this Doc View Source

Sign(IExpression)

Creates a function that returns the sign (positive, negative, or neither) of the expression in question

Declaration
public static IExpression Sign(IExpression expression)
Parameters
Type Name Description
IExpression expression

The numeric expression to evaluate

Returns
Type Description
IExpression

A function that returns the sign of the expression in question

| Improve this Doc View Source

Sin(IExpression)

Creates a function that returns the sin of the expression in question

Declaration
public static IExpression Sin(IExpression expression)
Parameters
Type Name Description
IExpression expression

The numeric expression to evaluate

Returns
Type Description
IExpression

A function that returns the sin of the expression in question

| Improve this Doc View Source

Sqrt(IExpression)

Creates a function that returns the square root of the expression in question

Declaration
public static IExpression Sqrt(IExpression expression)
Parameters
Type Name Description
IExpression expression

The numeric expression to evaluate

Returns
Type Description
IExpression

A function that returns the square root of the expression in question

| Improve this Doc View Source

SquaredEuclideanDistance(IExpression, IExpression)

Creates a function that returns the squared euclidean distance between two vectors of the same length. The result of the calculation is a positive floating-point number or null.

Declaration
public static IExpression SquaredEuclideanDistance(IExpression expression1, IExpression expression2)
Parameters
Type Name Description
IExpression expression1

The first input vector

IExpression expression2

The second input vector

Returns
Type Description
IExpression

An expression that can be further acted upon in the QueryBuilder

Remarks

NOTE: This is an enterprise edition feature

| Improve this Doc View Source

StringToMillis(IExpression)

Creates a function that will convert an ISO8601 datetime string into the number of milliseconds since the unix epoch.

Declaration
public static IExpression StringToMillis(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when converting

Returns
Type Description
IExpression

A function that will convert the string to a timestamp

Remarks

Valid date strings must start with a date in the form YYYY-MM-DD (time only strings are not supported).

Times can be of the form HH:MM, HH:MM:SS, or HH:MM:SS.FFF. Leading zero is not optional (i.e. 02 is ok, 2 is not). Hours are in 24-hour format. FFF represents milliseconds, and trailing zeros are optional (i.e. 5 == 500).

Time zones can be in one of three forms: (+/-)HH:MM (+/-)HHMM Z (which represents UTC)

No time zone present will default to the device local time zone

| Improve this Doc View Source

StringToUTC(IExpression)

Creates a function that will convert an ISO8601 datetime string into a full ISO8601 UTC datetime string.

Declaration
public static IExpression StringToUTC(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when converting

Returns
Type Description
IExpression

A function that will convert the string to a timestamp

Remarks

Valid date strings must start with a date in the form YYYY-MM-DD (time only strings are not supported).

Times can be of the form HH:MM, HH:MM:SS, or HH:MM:SS.FFF. Leading zero is not optional (i.e. 02 is ok, 2 is not). Hours are in 24-hour format. FFF represents milliseconds, and trailing zeros are optional (i.e. 5 == 500).

Time zones can be in one of three forms: (+/-)HH:MM (+/-)HHMM Z (which represents UTC)

No time zone present will default to the device local time zone

| Improve this Doc View Source

Sum(IExpression)

Creates a function that will calculate the sum of the expression in question across the results in a particular query

Declaration
public static IExpression Sum(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that will calculate the sum

| Improve this Doc View Source

Tan(IExpression)

Creates a function that returns the tangent of the expression in question

Declaration
public static IExpression Tan(IExpression expression)
Parameters
Type Name Description
IExpression expression

The numeric expression to evaluate

Returns
Type Description
IExpression

A function that returns the tangent of the expression in question

| Improve this Doc View Source

Trim(IExpression)

Creates a function that removes whitespace from the start and end of a string

Declaration
public static IExpression Trim(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that removes whitespace from the start and end of a string

| Improve this Doc View Source

Trunc(IExpression)

Creates a function that will truncate the given expression (i.e remove all the digits after the decimal place) in question

Declaration
public static IExpression Trunc(IExpression expression)
Parameters
Type Name Description
IExpression expression

The numeric expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that will truncate the expression

| Improve this Doc View Source

Trunc(IExpression, IExpression)

Creates a function that will truncate the given expression to the number of digits indicated in question

Declaration
public static IExpression Trunc(IExpression expression, IExpression digits)
Parameters
Type Name Description
IExpression expression

The numeric expression to take data from when calculating the result

IExpression digits

The number of digits to truncate to

Returns
Type Description
IExpression

A function that will truncate the expression

| Improve this Doc View Source

Upper(IExpression)

Creates a function that converts a string to upper case

Declaration
public static IExpression Upper(IExpression expression)
Parameters
Type Name Description
IExpression expression

The expression to take data from when calculating the result

Returns
Type Description
IExpression

A function that converts a string to upper case

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX