claire-framework
Version:
- được viết bằng TypeScript - hỗ trợ websocket và HTTP request - hỗ trợ CLI để generate base project (claire-cli)
72 lines • 3.83 kB
TypeScript
import { AbstractModel } from "./AbstractModel";
import { DataType } from "../enum/DataType";
import { FieldValidationMetadata } from "../validator/FieldValidationMetadata";
/**
* Init the logic field of the class if not exist or append properties to the existed field.
* @param prototype class object prototype.
* @param propertyKey logic name of the field.
* @param addedProperties the overriding properties.
*/
export declare const check_for_field: (prototype: any, propertyKey: string, addedProperties: Partial<FieldValidationMetadata>) => FieldValidationMetadata;
/**
* Mark a field of the model having a corresponding logic 'getter/setter' name.
* @param fieldLogicName the logic name of the field
*/
export declare const GetSet: (fieldLogicName: string) => (prototype: any, propertyKey: string) => void;
/**
* Mark a field of the model as the data field, which will be used to store the data.
* @param fieldDataName name of the field in the database table.
* @param innerDataType explicit data type to support the database engine.
*/
export declare const DataField: (fieldDataName?: string | undefined, innerDataType?: DataType | undefined) => (prototype: any, propertyKey: string) => void;
/**
* Mark a field of the model as primary key. If autoInc is true, the field is auto incremental.
* @param autoInc whether the key is auto-incremented.
*/
export declare const PrimaryKey: (autoInc: boolean) => (prototype: any, propertyKey: string) => void;
/**
* Mark a field of the model as foreign key. The referred model must be supplied.
* @param model the model to refer of which this field is primary key.
*/
export declare const ForeignKey: (model: new (...args: any[]) => AbstractModel) => (prototype: any, propertyKey: string) => void;
/**
* Mark the field with unique constraint.
*/
export declare const Unique: () => (prototype: any, propertyKey: string) => void;
/**
* Mark the field with can-be-null constraint.
*/
export declare const Optional: () => (prototype: any, propertyKey: string) => void;
/**
* Mark the field with can-not-be-null constraint.
*/
export declare const Required: () => (prototype: any, propertyKey: string) => void;
/**
* Default value of the field.
* @param value the default value.
*/
export declare const DefaultValue: (value: any) => (prototype: any, propertyKey: string) => void;
/**
* Mark the field as auto-generated. This field can be populate from the business logic but from the user.
*/
export declare const AutoGen: () => (prototype: any, propertyKey: string) => void;
export declare const IsFile: () => (prototype: any, propertyKey: string) => void;
/**
* Add description meta info for this field.
* @param comment the field description info.
*/
export declare const Comment: (comment: string) => (prototype: any, propertyKey: string) => void;
/**
* Mark the model that validation should be checked.
* @constructor
*/
export declare const Validate: () => <T extends new (...args: any[]) => {}>(constructor: T) => T;
export declare const Range: (from: number, to: number) => (prototype: any, propertyKey: string) => void;
export declare const InSet: (set: any[]) => (prototype: any, propertyKey: string) => void;
export declare const SubSet: (set: any[], allowEmpty?: boolean) => (prototype: any, propertyKey: string) => void;
export declare const Match: (regex: string) => (prototype: any, propertyKey: string) => void;
export declare const IsInteger: () => (prototype: any, propertyKey: string) => void;
export declare const IsArray: (allowEmpty?: boolean) => (prototype: any, propertyKey: string) => void;
export declare const GreaterThan: (value: number) => (prototype: any, propertyKey: string) => void;
export declare const LessThan: (value: number) => (prototype: any, propertyKey: string) => void;
//# sourceMappingURL=TableMapper.d.ts.map