Function: resourcefulColumn()
ts
function resourcefulColumn<Schema>(
options: Partial<ColumnOptions> &
Partial<ResourcefulColumnDefinition<Schema>>,
): (target: any, propertyKey: string) => void;Decorator to define a resourceful column on a Lucid model property. Applies validation, metadata, and Lucid column options.
Type Parameters
| Type Parameter | Default type |
|---|---|
Schema extends AnySchema<any> | ResourcefulPropertySchema |
Parameters
| Parameter | Type | Description |
|---|---|---|
options | Partial<ColumnOptions> & Partial<ResourcefulColumnDefinition<Schema>> | Resourceful column options and Lucid column options. |
Returns
Property decorator function.
ts
(target: any, propertyKey: string): void;Parameters
| Parameter | Type |
|---|---|
target | any |
propertyKey | string |
Returns
void
Example
ts
import {
resourcefulColumn,
ResourcefulStringType,
} from "@nhtio/lucid-resourceful";
class User {
@resourcefulColumn({
type: ResourcefulStringType({ minLength: 1, maxLength: 100 }),
nullable: false,
})
public name: string;
}