Type Signature
Overview
Updateable<T> is a utility type that extracts the update type from all columns in a table interface. It resolves the UpdateType from any ColumnType definitions and creates a type representing what you can update in the table.
Type Parameters
A table interface with column definitions.
Behavior
- Extracts the third type parameter (
UpdateType) from eachColumnType<SelectType, InsertType, UpdateType> - For regular types without
ColumnType, uses the type as-is - All fields are optional (since you typically update only some columns)
- Excludes columns where
UpdateTypeisnever
Examples
Basic Usage
- All fields are optional (updates are partial by nature)
created_atis excluded because itsUpdateTypeisnever
Using with Update Queries
Read-Only Columns
Different Types for Update
All Fields Optional
UnlikeInsertable, all fields in Updateable are optional since updates are typically partial:
Common Patterns
Function Parameters
Partial Updates with Type Safety
Conditional Updates
Combining with Omit for Restricted Updates
Repository Pattern
Related Types
ColumnType<SelectType, InsertType, UpdateType>- Define different types for different operationsSelectable<T>- Extract select types from a table interfaceInsertable<T>- Extract insert types from a table interfaceGenerated<T>- Shortcut for database-generated columnsGeneratedAlways<T>- Shortcut for always-generated columns