Skip to main content

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

R
interface
required
A table interface with column definitions.

Behavior

  • Extracts the third type parameter (UpdateType) from each ColumnType<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 UpdateType is never

Examples

Basic Usage

Notice:
  • All fields are optional (updates are partial by nature)
  • created_at is excluded because its UpdateType is never

Using with Update Queries

Read-Only Columns

Different Types for Update

All Fields Optional

Unlike Insertable, 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

Source

View source on GitHub