The entity the decorator is applied to.
The type of the attribute, restricted to native scalar attribute values and excluding foreign key types.
Optional
props: AttributeOptionsAn optional object of AttributeOptions, including configuration options such as metadata attributes and additional property characteristics.
A class field decorator function that targets and initializes the class's prototype to register the attribute with the ORM's metadata system, ensuring proper handling and validation of the entity's scalar values.
Usage example:
class Product extends BaseEntity {
@Attribute({ alias: 'SKU' })
public stockKeepingUnit: string; // Simple scalar attribute representing the product's SKU
}
Here, @Attribute
decorates stockKeepingUnit
of Product
as a simple, non-foreign key attribute, facilitating its management within the ORM system.
Generated using TypeDoc
A decorator for marking class fields as attributes within the context of a single-table design entity, with a specific restriction against using foreign key types.
IMPORTANT! - This decorator explicitly disallows the use of ForeignKey and NullableForeignKey types to maintain clear separation between entity relationships and scalar attributes for improved data integrity and type safety.