Decorator for generated/computed columns.
Usage with getter (for computed properties):
class User extends Model { @Generated() get fullName() { return `${this.firstName} ${this.lastName}`; } } Copy
class User extends Model { @Generated() get fullName() { return `${this.firstName} ${this.lastName}`; } }
Usage with options:
@Generated({ as: 'CONCAT(first_name, " ", last_name)', type: 'varchar(255)', stored: true }) fullName: string; Copy
@Generated({ as: 'CONCAT(first_name, " ", last_name)', type: 'varchar(255)', stored: true }) fullName: string;
Optional
Generated column options or just storage type
Decorator for generated/computed columns.
Usage with getter (for computed properties):
Usage with options: