Skip to content

Commit 15967c4

Browse files
authored
Add documents for date/time types. (#219)
1 parent f8edcc2 commit 15967c4

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

docs/docs/core/data_types.mdx

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,27 @@ This makes schema of data processed by CocoIndex clear, and easily determine the
1515

1616
This is the list of all basic types supported by CocoIndex:
1717

18-
| Type | Type in Python | Original Type in Python |
19-
|------|-----------------|--------------------------|
20-
| bytes | `bytes` | `bytes` |
21-
| str | `str` | `str` |
22-
| bool | `bool` | `bool` |
23-
| int64 | `int` | `int` |
24-
| float32 | `cocoindex.typing.Float32` |`float` |
25-
| float64 | `cocoindex.typing.Float64` |`float` |
26-
| range | `cocoindex.typing.Range` | `tuple[int, int]` |
27-
| uuid | `uuid.UUId` | `uuid.UUID` |
28-
| vector[*type*, *N*?] |`Annotated[list[type], cocoindex.typing.Vector(dim=N)]` | `list[type]` |
29-
| json | `cocoindex.typing.Json` | Any type convertible to JSON by `json` package |
30-
31-
For some types, CocoIndex Python SDK provides annotated types with finer granularity than Python's original type, e.g. `Float32` and `Float64` for `float`, and `vector` has dimension information.
18+
| Type | Description |Type in Python | Original Type in Python |
19+
|------|-------------|---------------|-------------------------|
20+
| Bytes | | `bytes` | `bytes` |
21+
| Str | | `str` | `str` |
22+
| Bool | | `bool` | `bool` |
23+
| Int64 | | `int` | `int` |
24+
| Float32 | | `cocoindex.typing.Float32` |`float` |
25+
| Float64 | | `cocoindex.typing.Float64` |`float` |
26+
| Range | | `cocoindex.typing.Range` | `tuple[int, int]` |
27+
| Uuid | | `uuid.UUId` | `uuid.UUID` |
28+
| Date | | `datetime.date` | `datetime.date` |
29+
| Time | | `datetime.time` | `datetime.time` |
30+
| LocalDatetime | Date and time without timezone | `cocoindex.typing.LocalDateTime` | `datetime.datetime` |
31+
| OffsetDatetime | Date and time with a timezone offset | `cocoindex.typing.OffsetDateTime` | `datetime.datetime` |
32+
| Vector[*type*, *N*?] | |`Annotated[list[type], cocoindex.typing.Vector(dim=N)]` | `list[type]` |
33+
| Json | | `cocoindex.typing.Json` | Any type convertible to JSON by `json` package |
34+
35+
For some types, CocoIndex Python SDK provides annotated types with finer granularity than Python's original type, e.g.
36+
* *Float32* and *Float64* for `float`, with different precision.
37+
* *LocalDateTime* and *OffsetDateTime* for `datetime.datetime`, with different timezone awareness.
38+
* *Vector* has dimension information.
3239

3340
When defining [custom functions](/docs/core/custom_function), use the specific types as type annotations for arguments and return values.
3441
So CocoIndex will have information about the specific type.
@@ -75,6 +82,7 @@ Currently, the following types are supported as types for key fields:
7582
- `int64`
7683
- `range`
7784
- `uuid`
85+
- `date`
7886
- Struct with all fields being key types
7987

8088
### Vector Type

0 commit comments

Comments
 (0)