Skip to content

Commit 11201c0

Browse files
committed
Documenting duration type
1 parent 69510a8 commit 11201c0

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

content/en/docs/genji-sql/data-types.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ There are basically two kinds of data types:
2727

2828
| Name | Description |
2929
| --- | --- |
30-
| integer | Alias for `int` |
3130
| int | Signed integer which takes 1, 2, 4 or 8 bytes depending on the size of the stored number |
31+
| integer | Alias for `int` |
32+
| duration | Represents a length of time in nanoseconds. Stored as an integer |
3233
| blob | Variable size blob of data |
3334
| text | Variable size UTF-8 encoded string |
3435
| array | Array of values of any type |
3536
| document | Object that contains pairs that associate a string field to a value of any type |
3637

37-
## The case of Null
38+
## The case of NULL
3839

3940
In Genji, *Null* is treated as both a value and a type. It represents the absence of data, and is returned in various cases:
4041

@@ -83,4 +84,4 @@ Arrays and documents cannot be converted to any other values.
8384

8485
### Implicit conversion
8586

86-
Implicit conversion usually takes place during the evaluation of an expression. Different rules may apply depending on the expression kind. Comparing values, evaluating literals, using arithmeric operators, all have their own set of implicit conversion rules.
87+
Implicit conversion usually takes place during the evaluation of an [expression]({{< relref "/docs/genji-sql/expressions" >}}). Different rules may apply depending on the expression kind. Comparing values, evaluating literals, using arithmetic operators, all have their own set of implicit conversion rules.

content/en/docs/genji-sql/lexical-structure.md

+19
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,25 @@ tRUe
6060
FALse
6161
```
6262

63+
### Durations
64+
65+
A duration is any sequence of character that starts with an [integer](#integers) and ends with one of the following unit:
66+
67+
* `ns` for nanoseconds (0.000000001 seconds)
68+
* `us` or `µs` for microseconds (0.000001 seconds)
69+
* `ms` for microseconds (0.001 seconds)
70+
* `s` for seconds
71+
* `m` for minutes
72+
* `h` for hours
73+
* `d` for days
74+
* `w` for weeks
75+
76+
```sql
77+
1ms
78+
40ns
79+
6w
80+
```
81+
6382
### Arrays
6483

6584
An array is any sequence of character that starts and ends with either:

0 commit comments

Comments
 (0)