Skip to main content
zerotal

Documentation


Documentation / @zerotal/orm / index / Columns

Type Alias: Columns<T>

Columns<T> = { [K in keyof T & string]: K extends `_${string}` ? never : T[K] extends (args: any[]) => any ? never : K }[keyof T & string]

Defined in: packages/orm/src/model/BaseModel.ts:475

Union of all data-column property names on a model class.

Excludes:

  • Methods / functions
  • Internal underscore-prefixed properties (_exists, _original, _zerotal_*)

Use this to give fillable, hidden, and hashable compile-time safety — TypeScript will catch typos and non-existent column references.

Type Parameters

T

T

Example

@table("users").withTimestamps()
export class User extends BaseModel {
  static fillable: Columns<User>[] = ["name", "email", "role"];
  static hidden:   Columns<User>[] = ["password"];
  static hashable: Columns<User>[] = ["password"];

  @column() name!: string;
  @column() email!: string;
  @column() password!: string;
  @column() role?: string;
}