EdgeQL Tutorial

Scalars

Subtopics

Data in EdgeDB is composed from: numbers, booleans, text, date, time, or JSON. So let's start with learning what these scalar types are and how they interact with each other.

The boolean values are represented by the words "true" and "false" (case-insensitive). Try selecting a boolean literal:

Input
Run
Output
Press the 'Run' button to evaluate the input

String literals are anything put inside either a pair of single or double quotes. They also support special escaped characters, such as "\n" for a new-line or even unicode. Try them out:

Input
Run
Output
Press the 'Run' button to evaluate the input

Bytes are very similar to strings in structure, but the bytes literals start with a b prefix. Since the characters inside the bytes literal are supposed to represent one byte each, no special unicode characters (like emojis) are allowed. Try them out:

Input
Run
Output
Press the 'Run' button to evaluate the input

Numbers can be divided into 2 categories based on whether they are of fixed finite size in memory or unlimited. By default number literals are taken to represent the fixed size integer or floating-point numbers used in many programming languages. Try them out:

Input
Run
Output
Press the 'Run' button to evaluate the input

Integers that are too large to fit into 64 bits will result in an error:

Input
Run
Output
Press the 'Run' button to evaluate the input

However, if you add n at the end of this very big integer, EdgeDB will know that this is supposed to be a number without any upper limit. Try adding the n at the end of it to make the error go away.

Similarly, the n suffix tells EdgeDB to treat floating point numbers as if they had infinite precision. Try the following example with and without the n suffix:

Input
Run
Output
Press the 'Run' button to evaluate the input