| 463 | } |
| 464 | |
| 465 | export class IdColumn< |
| 466 | Type extends IdColumnType = IdColumnType, |
| 467 | In = unknown, |
| 468 | Out = unknown, |
| 469 | > extends Column<Type, In, Out> { |
| 470 | id = true; |
| 471 | |
| 472 | constructor(type: Type, onInitNames: (ormName: string) => NameVariants) { |
| 473 | super(type, (ormName) => ({ |
| 474 | ...onInitNames(ormName), |
| 475 | mongodb: "_id", |
| 476 | })); |
| 477 | } |
| 478 | |
| 479 | override clone() { |
| 480 | const clone = new IdColumn(this.type, () => this.names); |
| 481 | clone.ormName = this.ormName; |
| 482 | clone.isNullable = this.isNullable; |
| 483 | clone.isUnique = this.isUnique; |
| 484 | clone.default = this.default; |
| 485 | clone.table = this.table; |
| 486 | return clone; |
| 487 | } |
| 488 | |
| 489 | override defaultTo$(fn: DefaultFunction<Type>) { |
| 490 | return super.defaultTo$(fn) as IdColumn<Type, In | null, Out>; |
| 491 | } |
| 492 | |
| 493 | override defaultTo(value: TypeMap[Type]) { |
| 494 | return super.defaultTo(value) as IdColumn<Type, In | null, Out>; |
| 495 | } |
| 496 | } |
| 497 | |
| 498 | export function column<Type extends keyof TypeMap>( |
| 499 | name: string | Partial<NameVariants>, |
nothing calls this directly
no outgoing calls
no test coverage detected