The entity the decorator is applied to.
The type of the attribute, restricted to string attribute values and excluding foreign key types.
Optional
props: PAn 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 string values.
Usage example:
class Product extends TableClass {
@StringAttribute({ alias: 'SKU' })
public stockKeepingUnit: string; // Simple string attribute representing the product's SKU
@StringAttribute({ alias: 'MyNullableField', nullable: true })
public myField?: string; // Set to Optional
}
Here, @StringAttribute
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 string 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 type to maintain clear separation between entity relationships and string attributes for improved data integrity and type safety.