Skip to content

ColumnConfig

Defined in: types.ts:28

Per-field configuration for database column behavior.

Keys in the columns record are proto field names (snake_case).

const repo = createRepository(UserSchema, {
engine,
columns: {
uid: { name: "user_id" },
computed_score: { ignore: true },
settings: { serialize: "json" },
create_time: { timestamp: "create" },
update_time: { timestamp: "update" },
},
});

optional ignore?: boolean

Defined in: types.ts:46

When true, the field is excluded from database serialization entirely. On reads, the field will have its proto3 default value.

Useful for fields that exist in the proto schema but have no corresponding database column (e.g. computed or virtual fields).


optional name?: string

Defined in: types.ts:37

Override the database column name for this field. Defaults to the field’s JSON name (camelCase).

{ name: "user_id" } // proto field "uid" → DB column "user_id"

optional serialize?: "json" | "binary"

Defined in: types.ts:57

Serialize nested messages or repeated fields for storage in a single database column.

  • "json" — uses toJsonString / fromJsonString from @bufbuild/protobuf for human-readable JSON storage.
  • "binary" — uses toBinary / fromBinary from @bufbuild/protobuf for compact binary storage.

optional timestamp?: "create" | "update"

Defined in: types.ts:67

Auto-populate this google.protobuf.Timestamp field on the specified lifecycle event using timestampNow().

  • "create" — set on create and batchCreate only.
  • "update" — set on create, batchCreate, update, and batchUpdate.