Add auto type convert for DB\IO

set via db options "db_convert_type" as array with "on", "json", "numeric",
"bytea"

"on" only converts know good types: "bool", "int"

"json" will convert json/jsonb to array
"bytea" will decode escaped bytea to string (note: this might change to resource)

"numeric" will convert to float.
NOTE: if a numeric number is too large a covnersion might drop data.
Use with care.

Convert flags can be chagned with dbSetConvertFlag and dbUnsetConvertFlag

All convert flags are in "DB\Options\Convert" as enum.
This commit is contained in:
Clemens Schwaighofer
2023-06-09 17:01:03 +09:00
parent 02e9610fad
commit ee62bd98ee
11 changed files with 849 additions and 80 deletions

View File

@@ -22,6 +22,7 @@ $DB_CONFIG = [
'db_type' => 'pgsql',
'db_encoding' => '',
'db_ssl' => 'allow', // allow, disable, require, prefer
// 'db_convert_type' => ['json'] // on, json, numeric, bytea
],
// same as above, but uses pg bouncer
'test_pgbouncer' => [