You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would love to show you this list of common operators and functions that would be great to have in typeDB. Some have been already added in this new patch but a lot of them are missing.
SurrealDB has been building these operators and functions thanks to their user base, and i think they have a pretty complete lib
- && or AND // Checks whether both of two values are truthy
- || or OR // Checks whether either of two values is truthy
- ?? // Check whether either of two values are truthy and not NULL
- ?: // Check whether either of two values are truthy
- = or IS // Check whether two values are equal
- != or IS NOT // Check whether two values are not equal
- == // Check whether two values are exactly equal
- ?= // Check whether any value in a set is equal to a value
- *= // Check whether all values in a set are equal to a value
- ~ // Compare two values for equality using fuzzy matching
- !~ // Compare two values for inequality using fuzzy matching
- ?~ // Check whether any value in a set is equal to a value using fuzzy matching
- *~ // Check whether all values in a set are equal to a value using fuzzy matching
- < // Check whether a value is less than another value
- <= // Check whether a value is less than or equal to another value
- > // Check whether a value is greater than another value
- >= // Check whether a value is greater than or equal to another value
- + // Add two values together
- - // Subtract a value from another value
- * or × // Multiply two values together
- / or ÷ // Divide a value by another value
- ** // Raises a base value by another value
- IN // Checks whether a value is contained within another value
- NOT IN // Checks whether a value is not contained within another value
- CONTAINS or ∋ // Checks whether a value contains another value
- CONTAINSNOT or ∌ // Checks whether a value does not contain another value
- CONTAINSALL or ⊇ // Checks whether a value contains all other values
- CONTAINSANY or ⊃ // Checks whether a value contains any other value
- CONTAINSNONE or ⊅ // Checks whether a value contains none of the following values
- INSIDE or ∈ // Checks whether a value is contained within another value
- NOTINSIDE or NOT IN or ∉ // Checks whether a value is not contained within another value
- ALLINSIDE or ⊆ // Checks whether all values are contained within other values
- ANYINSIDE or ⊂ // Checks whether any value is contained within other values
- NONEINSIDE or ⊄ // Checks whether no value is contained within other values
- OUTSIDE // Checks whether a geometry type is outside of another geometry type
- INTERSECTS // Checks whether a geometry type intersects another geometry type
⚠Notice that some of this functions can be used for key use-cases like autogenerate ids (particularly important as you will kill iids) and add timestamps when creating variables.
a default word on attributes would enable using these like this
Schema functions
#uuid key
define
id sub attribute, value string, default rand-uuid-v4();
person own id @key;
or some could be used as well on mutations like this:
insert $a has timestamp time-now()
or something like this for autoincrement
optional {
match
$person isa Person, has id $id
?nextId = max($id) +1
insert
$newPerson isa Person, has name "Peter", has id ?nextId
}
optional {
match
not { $person isa Person, has id $id };
insert
$newPerson isa Person, has name "Peter", has id 1
}
obviously something like id sub attribute, value long, default autoincrement(); would be even better, the example is just to show how powerful this can become
The text was updated successfully, but these errors were encountered:
@lveillard has already written a pretty exhaustive list! For my use case, I'd like the arithmetic operations enabled for long and double done on this #260 to work with datetime. Specifically,
adding days to a given date
function/arithmetic operation that can subtract two dates and output the number of days/weeks/months/years between the two given dates.
Or a function that converts the datetime to unix time so that arithmetic operations on long and double can be used
Bravo for the great additions of 2.18!
I would love to show you this list of common operators and functions that would be great to have in typeDB. Some have been already added in this new patch but a lot of them are missing.
SurrealDB has been building these operators and functions thanks to their user base, and i think they have a pretty complete lib
Operations:
Functions
⚠Notice that some of this functions can be used for key use-cases like autogenerate ids (particularly important as you will kill iids) and add timestamps when creating variables.
a
default
word on attributes would enable using these like thisSchema functions
related to typedb/typedb#6175
Mutation functions
or some could be used as well on mutations like this:
or something like this for autoincrement
obviously something like
id sub attribute, value long, default autoincrement();
would be even better, the example is just to show how powerful this can becomeThe text was updated successfully, but these errors were encountered: