Skip to content

Column Types

Mizzle provides a wide range of column types that map directly to DynamoDB’s native data types while providing TypeScript safety and automatic marshalling.

FunctionDynamoDB TypeDescription
string(name?)SStandard string.
number(name?)NNumber (automatically handled as strings in DynamoDB).
boolean(name?)BOOLBoolean value.
binary(name?)BBinary data.
uuid(name?)SString formatted as UUID.
date(name?)SISO-8601 Date string.
FunctionDynamoDB TypeDescription
json(name?)SJSON object stored as a string.
map(name?)MNative DynamoDB Map.
list(name?)LNative DynamoDB List.
FunctionDynamoDB TypeDescription
stringSet(name?)SSSet of unique strings.
numberSet(name?)NSSet of unique numbers.
binarySet(name?)BSSet of unique binary buffers.

All column builders support chaining methods to refine their behavior.

Ensures the column must have a value. In TypeScript, this removes null or undefined from the inferred type.

string("name").notNull()

Sets a static default value if no value is provided during insertion.

number("views").default(0)

Sets a dynamic default value using a function. This is useful for timestamps or random IDs.

string("id").$defaultFn(() => crypto.randomUUID())

Sets a value that is automatically recalculated whenever the record is updated.

date("updatedAt").$onUpdateFn(() => new Date())

Overrides the inferred TypeScript type. Useful for complex objects in json or map columns.

json("metadata").$type<{ color: string; size: number }>()

Explicitly marks a column as part of the primary key. While usually configured in the dynamoTable definition, these modifiers can be used for secondary indexes.