Type alias DataTypeAdapter<ModelType, DBType>
DataTypeAdapter<ModelType, DBType>: {
dbToModel: ((data: DBType) => Promise<ModelType> | ModelType);
generate?: (() => Promise<ModelType> | ModelType);
modelToDB: ((data: ModelType) => Promise<DBType> | DBType);
validate?: ((data: ModelType) => Promise<Error | true> | Error | true);
}
Type declaration
-
dbToModel: ((data: DBType) => Promise<ModelType> | ModelType)
-
- (data: DBType): Promise<ModelType> | ModelType
-
Returns Promise<ModelType> | ModelType
-
Optional
generate?: (() => Promise<ModelType> | ModelType)
-
- (): Promise<ModelType> | ModelType
-
Returns Promise<ModelType> | ModelType
-
modelToDB: ((data: ModelType) => Promise<DBType> | DBType)
-
- (data: ModelType): Promise<DBType> | DBType
-
Returns Promise<DBType> | DBType
-
Optional
validate?: ((data: ModelType) => Promise<Error | true> | Error | true)
-
- (data: ModelType): Promise<Error | true> | Error | true
-
Returns Promise<Error | true> | Error | true