Type Alias: StateUpdate<T>

StateUpdate<T> = LixUpdateable<EntityStateView<T>>

Type for updating entities in the active version.

This type makes all columns optional, allowing partial updates. Only include the fields you want to change - the database will preserve existing values for omitted fields.

Type Parameters

T

T

Example

// Use StateUpdate for update form data
interface UpdateSettingData {
  updates: StateUpdate<KeyValue>;
}

async function updateSetting(key: string, updates: UpdateSettingData) {
  // Only update the fields that changed
  const patch: StateUpdate<KeyValue> = {
    value: updates.updates.value
    // key, timestamps, etc. remain unchanged
  };

  await lix.db
    .updateTable("key_value")
    .set(patch)
    .where("key", "=", key)
    .execute();
}