-
-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Labels
severity:BC breakingBreaks backwards compatibilityBreaks backwards compatibilitytype:enhancementEnhancementEnhancement
Milestone
Description
Proposed new feature or change
- to avoid additional database queries to obtain column information for type casting;
- to be able to specify a custom type for columns for type casting.
A possible solution is to add ability to specify types for casting directly for each column in query results:
$query->withTypecasting([
'*' => true, // automatically typecast all columns using `PDOStatement::getColumnMeta()`
'name' => ColumnType::STRING, // abstract type
'age' => 'int', // database type
'birthday' => false, // do not typecast
'is_active' => new BooleanColumn(),
'created_at' => new DateTimeColumn(),
]);The types can be presented as
- instances of
ColumnInterface; - string names of types (e.g.
int,char(20),json, etc); trueto automatically detect type usingPDOStatement::getColumnMeta();- empty value (
null,falseor '') which means without typecasting.
Also possible to use * as a column name to specify default type for all columns.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
severity:BC breakingBreaks backwards compatibilityBreaks backwards compatibilitytype:enhancementEnhancementEnhancement