Basic Syntax
Scalar Types
UUID
Universally unique identifier (RFC 4122):uuid
128-bit universally unique identifier. Commonly used for primary keys.Example:SQL Mapping:
UUID (PostgreSQL)String
Variable-length text data:string
UTF-8 encoded text of arbitrary length.Example:SQL Mapping:
TEXT (PostgreSQL)Int
Signed integer:int
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:decimal
Fixed-point decimal number with arbitrary precision. Suitable for currency and financial calculations.Example:SQL Mapping:
NUMERIC (PostgreSQL)Bool
Boolean value:bool
True or false value.Example:SQL Mapping:
BOOLEAN (PostgreSQL)Timestamp
Date and time with timezone:timestamp
Date and time value with timezone information.Example:SQL Mapping:
TIMESTAMPTZ (PostgreSQL)Float
Floating-point number:float
64-bit floating-point number (IEEE 754 double precision).Example:SQL Mapping:
DOUBLE PRECISION (PostgreSQL)Special Types
Vector
Fixed-size vector for embeddings:vector
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
Array of values of a single type.Syntax:Example:SQL Mapping:
type[] (PostgreSQL array type)Type Reference Table
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
Best Practices
Next Steps
Constraints
Add validation with constraints
Relations
Define entity relationships