Basic Syntax
Scalar Types
UUID
Universally unique identifier (RFC 4122):128-bit universally unique identifier. Commonly used for primary keys.Example:SQL Mapping:
UUID (PostgreSQL)String
Variable-length text data:UTF-8 encoded text of arbitrary length.Example:SQL Mapping:
TEXT (PostgreSQL)Int
Signed integer:64-bit signed integer (-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807).Example:SQL Mapping:
BIGINT (PostgreSQL)Decimal
Arbitrary precision decimal number:Fixed-point decimal number with arbitrary precision. Suitable for currency and financial calculations.Example:SQL Mapping:
NUMERIC (PostgreSQL)Bool
Boolean value:True or false value.Example:SQL Mapping:
BOOLEAN (PostgreSQL)Timestamp
Date and time with timezone:Date and time value with timezone information.Example:SQL Mapping:
TIMESTAMPTZ (PostgreSQL)Float
Floating-point number:64-bit floating-point number (IEEE 754 double precision).Example:SQL Mapping:
DOUBLE PRECISION (PostgreSQL)Special Types
Vector
Fixed-size vector for embeddings:Fixed-size vector of N dimensions for machine learning embeddings.Syntax:Example:Requirements:
- Must specify dimension count
- Typically used with
@vectorannotation - Dimension must be a positive integer
VECTOR(N) (PostgreSQL with pgvector extension)Collection Types
Array
Ordered collection of values:Array of values of a single type.Syntax:Example:SQL Mapping:
type[] (PostgreSQL array type)Type Reference Table
| ChameleonDB Type | Description | PostgreSQL Mapping | Example |
|---|---|---|---|
uuid | Unique identifier | UUID | id: uuid primary |
string | Text data | TEXT | name: string |
int | Integer | BIGINT | age: int |
decimal | Precise decimal | NUMERIC | price: decimal |
bool | Boolean | BOOLEAN | active: bool |
timestamp | Date/time | TIMESTAMPTZ | created_at: timestamp |
float | Floating-point | DOUBLE PRECISION | rating: float |
vector(N) | ML embedding | VECTOR(N) | embedding: vector(384) |
[type] | Array | type[] | tags: [string] |
Complete Example
Type Validation
ChameleonDB validates field types at compile time:Type Existence - All types must be recognized
Vector Dimensions -
vector(N) requires a valid dimension countArray Elements - Array element types must be valid scalar types
Default Values - Default values must match the field type