Appearance
DoCurious API Reference / adapters / mapSqlBase
Function: mapSqlBase()
mapSqlBase<
T>(sql):Omit<T,"id"|"uuid"|"created_at"|"updated_at"|"deleted_at"> &object
Defined in: adapters/idAdapter.ts:52
Map a single SQL entity to FE BaseEntity shape.
Promotes uuid to id, converts created_at/updated_at to camelCase, and strips the numeric id and deleted_at fields.
Type Parameters
T
T extends SqlBaseEntity
Parameters
sql
T
Raw database row extending SqlBaseEntity
Returns
Omit<T, "id" | "uuid" | "created_at" | "updated_at" | "deleted_at"> & object
The row with uuid promoted to id and timestamps in camelCase
Example
ts
const sqlRow = { id: 1, uuid: 'abc-123', created_at: '2024-01-01', updated_at: null }
const result = mapSqlBase(sqlRow)
// { id: 'abc-123', createdAt: '2024-01-01', updatedAt: '2024-...' }