Open renne opened 2 months ago
It should already support boolean types using the TypeMap.
Do you have a database adapter and column definition I can test with, it might be the internal type name needs adding to the map.
The database adapter is MariaDB Node.js connector. Example:
CREATE TABLE IF NOT EXISTS `users` (
`created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation date',
`email` TEXT(256) UNIQUE NOT NULL DEFAULT '' COMMENT 'E-mail address',
`institution` TEXT(128) NOT NULL DEFAULT '' COMMENT 'Institution',
`isEditor` BOOLEAN NOT NULL DEFAULT FALSE COMMENT 'Editor status',
`lastChanged` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Last change date',
`name` TEXT(128) NOT NULL DEFAULT '' COMMENT 'Username (prenames surname)',
`phone` TEXT(16) NOT NULL DEFAULT '' COMMENT 'Phone number',
`userID` UUID NOT NULL DEFAULT UUID() COMMENT 'UserID',
PRIMARY KEY (`userID`)
) ENGINE=InnoDB DEFAULT CHARSET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'List of users';
isEditor
becomes tinyint(1)
in the MariaDB DBMS:
MariaDB [backend]> show columns from users;
+-------------+------------+------+-----+---------------------+-------------------------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+------------+------+-----+---------------------+-------------------------------+
| created | timestamp | NO | | current_timestamp() | |
| email | text | NO | UNI | '' | |
| institution | text | NO | | '' | |
| isEditor | tinyint(1) | NO | | 0 | |
| lastChanged | timestamp | NO | | current_timestamp() | on update current_timestamp() |
| name | text | NO | | '' | |
| phone | tinytext | NO | | '' | |
| userID | uuid | NO | PRI | uuid() | |
+-------------+------------+------+-----+---------------------+-------------------------------+
8 rows in set (0.003 sec)
SQL-TS interpretes it as data-type number
:
/* Editor status */
'isEditor'?: number;
Please support data-type boolean in sql-ts.