/// <summary> /// Constructs a Timestamp representing the transaction’s start time. /// <para> /// See the <see href="https://docs.fauna.com/fauna/current/api/fql/functions/now">FaunaDB Now Functions</see> /// </para> /// </summary> public static Expr Now() => UnescapedObject.With("now", Null());
/// <summary> /// Creates a new Epoch expression. /// <para> /// See the <see href="https://fauna.com/documentation/queries#time_functions">FaunaDB Time and Date Functions</see> /// </para> /// </summary> public static Expr Epoch(Expr number, Expr unit) => UnescapedObject.With("epoch", number, "unit", unit);
/// <summary> /// Creates a new Date expression. /// <para> /// See the <see href="https://fauna.com/documentation/queries#time_functions">FaunaDB Time and Date Functions</see> /// </para> /// </summary> public static Expr Date(Expr date) => UnescapedObject.With("date", date);
/// <summary> /// Creates a new Foreach expression. /// <para> /// <see href="https://fauna.com/documentation/queries#collection_functions">FaunaDB Collection Functions</see> /// </para> /// <para> /// See <see cref="Foreach(Expr, System.Func{Expr, Expr})"/>, /// <see cref="Foreach(Expr, System.Func{Expr, Expr, Expr})"/>, /// <see cref="Foreach(Expr, System.Func{Expr, Expr, Expr, Expr})"/>, /// <see cref="Foreach(Expr, System.Func{Expr, Expr, Expr, Expr, Expr})"/>, /// <see cref="Foreach(Expr, System.Func{Expr, Expr, Expr, Expr, Expr, Expr})"/>, /// <see cref="Foreach(Expr, System.Func{Expr, Expr, Expr, Expr, Expr, Expr, Expr})"/> /// </para> /// <para> /// This is the raw version. Usually it's easier to use the overload. /// </para> /// </summary> /// <param name="collection">A collection expression</param> /// <param name="lambda">Lambda expression created by <see cref="Lambda(Expr, Expr)"/></param> public static Expr Foreach(Expr collection, Expr lambda) => UnescapedObject.With("foreach", lambda, "collection", collection);
/// <summary> /// Creates a new AccessProvider expression. /// <para> /// See the <see href="https://docs.fauna.com/fauna/current/api/fql/functions/accessprovider">docs</see>. /// </para> /// </summary> public static Expr AccessProvider(Expr name, Expr scope) => UnescapedObject.With("access_provider", name, "scope", scope);
/// <summary> /// Creates a new Append expression. /// <para> /// <see href="https://fauna.com/documentation/queries#collection_functions">FaunaDB Collection Functions</see> /// </para> /// </summary> /// <param name="elements">Elements to be appended into the collection</param> /// <param name="collection">A collection expression</param> /// <example> /// <code> /// var result = await client.Query(Append(Arr(4, 5, 6), Arr(1, 2, 3))); /// /// Assert.AreEqual(Arr(1, 2, 3, 4, 5, 6), result); /// </code> /// </example> public static Expr Append(Expr elements, Expr collection) => UnescapedObject.With("append", elements, "collection", collection);
/// <summary> /// Creates a new Reverse expression. /// <para> /// <see href="https://docs.fauna.com/fauna/current/api/fql/functions/reverse">FaunaDB Reverse Function</see> /// </para> /// </summary> /// <param name="expr">An expression</param> /// <example> /// <code> /// var result = await client.Query(Reverse(Arr(0, 1, 2, 3))); /// /// Assert.AreEqual(new int[] { 3, 2, 1, 0 }, result.To<int[]>().Value); /// </code> /// </example> public static Expr Reverse(Expr expr) => UnescapedObject.With("reverse", expr);
/// <summary> /// Creates a new Login expression. /// <para> /// See the <see href="https://fauna.com/documentation/queries#auth_functions">docs</see>. /// </para> /// </summary> public static Expr Login(Expr @ref, Expr @params) => UnescapedObject.With("login", @ref, "params", @params);
/// <summary> /// Creates a new Logout expression. /// <para> /// See the <see href="https://fauna.com/documentation/queries#auth_functions">docs</see>. /// </para> /// </summary> /// <param name="deleteTokens">True will delete all tokens associated with the current session. False will delete only the token used in this request</param> public static Expr Logout(bool deleteTokens) => UnescapedObject.With("logout", deleteTokens);
/// <summary> /// Creates a new NGram expression. /// <para> /// See the <see href="https://app.fauna.com/documentation/reference/queryapi#string-functions">FaunaDB String Functions</see> /// </para> /// </summary> public static Expr NGram(Expr terms, Expr min = null, Expr max = null) => UnescapedObject.With("ngram", terms, "min", min, "max", max);
/// <summary> /// Format values into string. /// <para> /// See the <see href="https://docs.fauna.com/fauna/current/api/fql/functions/format">FaunaDB Format Function</see> /// </para> /// </summary> public static Expr Format(Expr format, params Expr[] values) => UnescapedObject.With("format", format, "values", Varargs(values));
/// <summary> /// Creates a new Casefold expression. /// <para> /// See the <see href="https://app.fauna.com/documentation/reference/queryapi#string-functions">FaunaDB String Functions</see> /// </para> /// </summary> public static Expr Casefold(Expr @string, Expr normalizer = null) => UnescapedObject.With("casefold", @string, "normalizer", normalizer);
/// <summary> /// Creates a new Concat expression. /// <para> /// See the <see href="https://app.fauna.com/documentation/reference/queryapi#string-functions">FaunaDB String Functions</see> /// </para> /// </summary> public static Expr Concat(Expr strings, Expr separator = null) => UnescapedObject.With("concat", strings, "separator", separator);
/// <summary> /// Creates a new CreateAccessProvider expression. /// <para> /// See the <see href="https://app.fauna.com/documentation/reference/queryapi#write-functions">docs</see>. /// </para> /// </summary> public static Expr CreateAccessProvider(Expr expr) => UnescapedObject.With("create_access_provider", expr);
/// <summary> /// Creates a new Take expression. /// <para> /// <see href="https://fauna.com/documentation/queries#collection_functions">FaunaDB Collection Functions</see> /// </para> /// </summary> /// <param name="number">Number of elements to take from the head of collection</param> /// <param name="collection">A collection expression</param> /// <example> /// <code> /// var result = await client.Query(Take(2, Arr(1, 2, 3))); /// /// Assert.AreEqual(Arr(1, 2), result); /// </code> /// </example> public static Expr Take(Expr number, Expr collection) => UnescapedObject.With("take", number, "collection", collection);
/// <summary> /// Creates a new Identify expression. /// <para> /// See the <see href="https://fauna.com/documentation/queries#auth_functions">docs</see>. /// </para> /// </summary> /// <param name="ref">Reference to the object</param> /// <param name="password">Password to be validated</param> public static Expr Identify(Expr @ref, Expr password) => UnescapedObject.With("identify", @ref, "password", password);
/// <summary> /// Creates a new Drop expression. /// <para> /// <see href="https://fauna.com/documentation/queries#collection_functions">FaunaDB Collection Functions</see> /// </para> /// </summary> /// <param name="number">Number of elements to drop from the head of collection</param> /// <param name="collection">A collection expression</param> /// <example> /// <code> /// var result = await client.Query(Drop(2, Arr(1, 2, 3))); /// /// Assert.AreEqual(Arr(3), result); /// </code> /// </example> public static Expr Drop(Expr number, Expr collection) => UnescapedObject.With("drop", number, "collection", collection);
/// <summary> /// Creates a new Identity expression. /// <para> /// See the <see href="https://fauna.com/documentation/queries#auth_functions">docs</see>. /// </para> /// </summary> public static Expr Identity() => UnescapedObject.With("identity", Null());
/// <summary> /// Creates a new IsNonEmpty expression. /// <para> /// <see href="https://fauna.com/documentation/queries#collection_functions">FaunaDB Collection Functions</see> /// </para> /// </summary> /// <param name="collection">A collection expression</param> /// <example> /// <code> /// var result = await client.Query(IsNonEmpty(Arr(4, 5, 6))); /// /// Assert.AreEqual(true, result.To<bool>().Value); /// </code> /// </example> public static Expr IsNonEmpty(Expr collection) => UnescapedObject.With("is_nonempty", collection);
/// <summary> /// Creates a new HasIdentity expression. /// <para> /// See the <see href="https://fauna.com/documentation/queries#auth_functions">docs</see>. /// </para> /// </summary> public static Expr HasIdentity() => UnescapedObject.With("has_identity", Null());
/// <summary> /// Creates a new Map expression. /// <para> /// <see href="https://fauna.com/documentation/queries#collection_functions">FaunaDB Collection Functions</see> /// </para> /// <para> /// This is the raw version. Usually it's easier to use the overload. /// </para> /// <para> /// See <see cref="Map(Expr, System.Func{Expr, Expr})"/>, /// <see cref="Map(Expr, System.Func{Expr, Expr, Expr})"/>, /// <see cref="Map(Expr, System.Func{Expr, Expr, Expr, Expr})"/>, /// <see cref="Map(Expr, System.Func{Expr, Expr, Expr, Expr, Expr})"/>, /// <see cref="Map(Expr, System.Func{Expr, Expr, Expr, Expr, Expr, Expr})"/>, /// <see cref="Map(Expr, System.Func{Expr, Expr, Expr, Expr, Expr, Expr, Expr})"/> /// </para> /// </summary> /// <param name="collection">A collection expression</param> /// <param name="lambda">Lambda expression created by <see cref="Lambda(Expr, Expr)"/></param> /// <example> /// <code> /// var result = await client.Query(Arr(1, 2, 3), Lambda("i", Multiply(Var("i"), 2))); /// /// Assert.AreEqual(Arr(2, 4, 6), result); /// </code> /// </example> public static Expr Map(Expr collection, Expr lambda) => UnescapedObject.With("map", lambda, "collection", collection);
/// <summary> /// Creates a new Time expression. /// <para> /// See the <see href="https://fauna.com/documentation/queries#time_functions">FaunaDB Time and Date Functions</see> /// </para> /// </summary> public static Expr Time(Expr time) => UnescapedObject.With("time", time);
/// <summary> /// Creates a new Filter expression. /// <para> /// <see href="https://fauna.com/documentation/queries#collection_functions">FaunaDB Collection Functions</see> /// </para> /// <para> /// This is the raw version. Usually it's easier to use the overload. /// </para> /// <para> /// See <see cref="Filter(Expr, System.Func{Expr, Expr})"/>, /// <see cref="Filter(Expr, System.Func{Expr, Expr, Expr})"/>, /// <see cref="Filter(Expr, System.Func{Expr, Expr, Expr, Expr})"/>, /// <see cref="Filter(Expr, System.Func{Expr, Expr, Expr, Expr, Expr})"/>, /// <see cref="Filter(Expr, System.Func{Expr, Expr, Expr, Expr, Expr, Expr})"/>, /// <see cref="Filter(Expr, System.Func{Expr, Expr, Expr, Expr, Expr, Expr, Expr})"/> /// </para> /// </summary> /// <param name="collection">A collection expression</param> /// <param name="lambda">Lambda expression created by <see cref="Lambda(Expr, Expr)"/>. It must return a boolean value.</param> /// <example> /// <code> /// var result = await client.Query(Filter(Arr(1, 2, 3, 4), Lambda("i", GT(Var("i"), 2)))); /// /// Assert.AreEqual(Arr(3, 4), result); /// </code> /// </example> public static Expr Filter(Expr collection, Expr lambda) => UnescapedObject.With("filter", lambda, "collection", collection);
/// <summary> /// Creates a new AccessProviders expression. /// <para> /// See the <see href="https://docs.fauna.com/fauna/current/api/fql/functions/accessprovider">docs</see>. /// </para> /// </summary> public static Expr AccessProviders(Expr scope = null) => UnescapedObject.With("access_providers", scope ?? Null());