Types
Every property has a type — scalars, enums, lists, vectors, and blobs.
Every property in a .pg schema must have a type. Types determine how values are stored, validated, and indexed.
Scalar types
| Type | Description | Example values |
|---|---|---|
String | UTF-8 text, variable length. | "hello" |
Bool | Boolean. | true, false |
I32 | Signed 32-bit integer. | -42, 0, 100 |
I64 | Signed 64-bit integer. | 9_000_000_000 |
U32 | Unsigned 32-bit integer. | 0, 4_294_967_295 |
U64 | Unsigned 64-bit integer. | 0, 18_446_744_073_709_551_615 |
F32 | 32-bit floating point. | 3.14 |
F64 | 64-bit floating point. | 2.718281828 |
Date | Calendar date (no time). | 2025-06-15 |
DateTime | Date and time with timezone. | 2025-06-15T09:30:00Z |
node Measurement {
sensor: String @key
timestamp: DateTime
value: F64
count: U32
active: Bool
}Enum types
An inline enumeration restricts a property to a fixed set of string values. Values are declared inside enum(...):
node Task {
slug: String @key
status: enum(pending, in_progress, completed, cancelled)
}Enum values are unquoted identifiers. They are stored as strings but validated at load and mutation time — any value not in the declared set is rejected.
List types
Wrap a type in [...] to declare a list property:
node Paper {
doi: String @key
authors: [String]
scores: [F64]
tags: [String]
}Lists are variable-length and ordered. The element type must be a scalar — nested lists and lists of vectors are not supported.
Vector types
Vector(N) declares a fixed-dimension floating-point vector, used for embeddings and similarity search:
node Document {
title: String @key
embedding: Vector(1536) @embed(source: title)
}The dimension N is a positive integer specified at schema time. All vectors in a column must have exactly N elements.
Vector annotations
| Annotation | Purpose |
|---|---|
@embed | Marks the vector for automatic embedding. |
@embed(source: prop) | Specifies which text property to embed from. |
@index | Creates an IVF-HNSW index for approximate nearest-neighbor search. |
node Chunk {
content: String
embedding: Vector(768) @embed(source: content) @index
}Blob types
Blob stores arbitrary binary data. Use it for images, PDFs, or other opaque payloads:
node Attachment {
name: String @key
mime: String
payload: Blob
}Blob properties cannot be indexed or used in constraints.
Nullability
Any type can be made nullable by appending ?:
node Person {
name: String # required — every row must have a value
email: String? # optional — may be null
age: I32? # optional
tags: [String]? # optional list
}A required property (no ?) must be present in every insert. A nullable property can be omitted or explicitly set to null.