Announcing new FQL features
Tags: serverless, database, jamstack, graphql
Published: 2019-12-06 00:10:54

Author: Lewis King
Date: December 5, 2019
[Originally posted on the Fauna blog.](https://fauna.com/blog/announcing-new-fql-features)

--

We’re pleased to announce new FQL capabilities that empower users to write more concise and powerful FQL statements with:

- Date/Time arithmetic functions
- Any/All functions
- Type cast functions
- Type check functions

#New preview features#
Please note that these new functions are currently in [Preview mode](https://fauna.com/blog/software-naming-releases), which means that they will be fully supported in the JVM and JS drivers only and will continue to improve over the next 2 months. We invite you to send us feedback about their use. To learn more, please check out our [documentation](https://docs.fauna.com/).

###Date/Time arithmetic functions###
The following Date/Time arithmetic functions have been implemented:

**TimeAdd(), TimeSubtract(), and TimeDiff()**
```
TimeAdd(Date("1970-01-01"), 1, "day")
TimeSubtract(Time("1970-01-01T00:00:00Z"), 10, "minutes")
TimeDiff(Date("1970-01-01"), Date("1970-01-02"), "days")
```
###Any() and All() functions###
Any() and All() reduce their parameter to a boolean: are any items true, or are all items true, respectively. They work like Or() and And() but for sets, arrays, and pages.

Unlike the existing boolean functions, Any() and All() have default values for empty inputs. (<code>Any([])</code> returns <code>false</code>, and <code>All([])</code> returns <code>true</code>).
```
Any(Map(Paginate(Match("user_ages_by_name", "Alice")), Lambda("age", GTE(Var("age"), 18)))
```

#Type cast functions#
The following type casting functions have been implemented: 

**ToDouble, ToArray, ToObject, and ToInteger**
```
ToDouble(1) => 1.0
ToInteger(3.14) => 3
ToArray({x: 10, y: 20}) => [["x", 10], ["y", 20]]
ToObject([["x", 10], ["y", 20]]) => {x: 10, y: 20}
```
#Type check functions#
The following type check functions have been implemented: 

**IsNumber, IsDouble, IsInteger, IsBoolean, IsNull, IsBytes, IsTimestamp, IsDate, IsString, IsArray, IsObject, IsRef, IsSet, IsDoc, IsLambda, IsCollection, IsDatabase, IsIndex, IsFunction, IsKey, IsToken, IsCredentials,** and **IsRole** 

An example of one of these in use:
```
IsDouble(3.14) => true
```
###New GA Features ###
We’re excited to announce that the new FQL functions that we released in Preview mode [back in September](https://fauna.com/blog/announcing-new-functions-in-fql) are now generally available. This means that the functions are now also available in our Go, C#, and Python drivers. It also means that these functions are part of the FQL core product and you can expect them to be fully reliable. 

New GA functions include **Range, Reduce, Format,** and **Merge**. 

#Conclusion#
With our latest FaunaDB update, users now have access to new FQL functionality including date arithmetic and type cast and check functions.

These methods are in Preview! So please [let us know](https://twitter.com/fauna) what you think so that we can incorporate feedback into the formal release, and visit our [documentation](https://docs.fauna.com/fauna/2.7.0/guides/rbac) to learn more. 

What other functions would you like to see implemented in FaunaDB? Please reach out to me on our [Community Slack](https://community-invite.fauna.com/) and describe any other features that would make FaunaDB an obvious choice for your next project.