From accfff2f692e50b67bdd0925cf18fb51a3bb2f7c Mon Sep 17 00:00:00 2001 From: Marin Bezhanov Date: Fri, 27 Sep 2024 16:05:09 +0300 Subject: [PATCH] Add regex support to `only` and `except` table filters --- CHANGELOG.md | 1 + .../driver/exclude-tables.golden.json | 2117 ++++++++ .../include-exclude-tables-mixed.golden.json | 103 + .../include-exclude-tables-regex.golden.json | 103 + .../driver/include-exclude-tables.golden.json | 55 + .../driver/include-tables.golden.json | 103 + gen/bobgen-mysql/driver/mysql.go | 30 +- gen/bobgen-mysql/driver/mysql.golden.json | 250 +- gen/bobgen-mysql/driver/mysql_test.go | 70 + .../driver/exclude-tables.golden.json | 4251 +++++++++++++++++ .../include-exclude-tables-mixed.golden.json | 114 + .../include-exclude-tables-regex.golden.json | 114 + .../driver/include-exclude-tables.golden.json | 66 + .../driver/include-tables.golden.json | 114 + gen/bobgen-psql/driver/psql.go | 31 +- gen/bobgen-psql/driver/psql.golden.json | 240 + gen/bobgen-psql/driver/psql_test.go | 70 + gen/drivers/table.go | 20 + test/files/mysql/schema.sql | 25 +- test/files/psql/schema.sql | 25 + website/docs/code-generation/mysql.md | 26 +- website/docs/code-generation/psql.md | 26 +- 22 files changed, 7937 insertions(+), 17 deletions(-) create mode 100644 gen/bobgen-mysql/driver/exclude-tables.golden.json create mode 100644 gen/bobgen-mysql/driver/include-exclude-tables-mixed.golden.json create mode 100644 gen/bobgen-mysql/driver/include-exclude-tables-regex.golden.json create mode 100644 gen/bobgen-mysql/driver/include-exclude-tables.golden.json create mode 100644 gen/bobgen-mysql/driver/include-tables.golden.json create mode 100644 gen/bobgen-psql/driver/exclude-tables.golden.json create mode 100644 gen/bobgen-psql/driver/include-exclude-tables-mixed.golden.json create mode 100644 gen/bobgen-psql/driver/include-exclude-tables-regex.golden.json create mode 100644 gen/bobgen-psql/driver/include-exclude-tables.golden.json create mode 100644 gen/bobgen-psql/driver/include-tables.golden.json diff --git a/CHANGELOG.md b/CHANGELOG.md index e7b928f8..098c1c35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added error constants for matching against both specific and generic unique constraint errors raised by the underlying database driver. (thanks @mbezhanov) +- Added support for regular expressions in the `only` and `except` table filters. ### Removed diff --git a/gen/bobgen-mysql/driver/exclude-tables.golden.json b/gen/bobgen-mysql/driver/exclude-tables.golden.json new file mode 100644 index 00000000..253425b2 --- /dev/null +++ b/gen/bobgen-mysql/driver/exclude-tables.golden.json @@ -0,0 +1,2117 @@ +{ + "tables": [ + { + "key": "bar_baz", + "schema": "", + "name": "bar_baz", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "bar_qux", + "schema": "", + "name": "bar_qux", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "foo_qux", + "schema": "", + "name": "foo_qux", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "multi_keys", + "schema": "", + "name": "multi_keys", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + }, + { + "name": "user_id", + "db_type": "int", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "sponsor_id", + "db_type": "int", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "something", + "db_type": "int", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "another", + "db_type": "int", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "one", + "db_type": "int", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "two", + "db_type": "int", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "one", + "columns": [ + "one", + "two" + ], + "expressions": null + }, + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + }, + { + "name": "something", + "columns": [ + "something", + "another" + ], + "expressions": null + }, + { + "name": "sponsor_id", + "columns": [ + "sponsor_id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": [ + { + "name": "multi_keys_ibfk_1", + "columns": [ + "one", + "two" + ], + "foreign_table": "type_monsters", + "foreign_columns": [ + "int_one", + "int_two" + ] + } + ], + "uniques": [ + { + "name": "something", + "columns": [ + "something", + "another" + ] + }, + { + "name": "sponsor_id", + "columns": [ + "sponsor_id" + ] + } + ] + } + }, + { + "key": "sponsors", + "schema": "", + "name": "sponsors", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "tags", + "schema": "", + "name": "tags", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "test_index_expressions", + "schema": "", + "name": "test_index_expressions", + "columns": [ + { + "name": "col1", + "db_type": "int", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "col2", + "db_type": "int", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "col3", + "db_type": "int", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "idx1", + "columns": null, + "expressions": [ + "(`col1` + `col2`)" + ] + }, + { + "name": "idx2", + "columns": [ + "col3" + ], + "expressions": [ + "(`col1` + `col2`)" + ] + }, + { + "name": "idx3", + "columns": [ + "col1" + ], + "expressions": [ + "(`col2` + `col3`)" + ] + }, + { + "name": "idx4", + "columns": [ + "col3" + ], + "expressions": null + }, + { + "name": "idx5", + "columns": [ + "col1", + "col2" + ], + "expressions": null + }, + { + "name": "idx6", + "columns": null, + "expressions": [ + "pow(`col3`,2)" + ] + } + ], + "constraints": { + "primary": null, + "foreign": null, + "uniques": null + } + }, + { + "key": "type_monsters", + "schema": "", + "name": "type_monsters", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "comment on ID", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + }, + { + "name": "enum_use", + "db_type": "enum", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "TypeMonstersEnumUse" + }, + { + "name": "enum_nullable", + "db_type": "enum", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "TypeMonstersEnumNullable" + }, + { + "name": "id_two", + "db_type": "int", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "id_three", + "db_type": "int", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "bool_zero", + "db_type": "bool", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "bool_one", + "db_type": "bool", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "bool_two", + "db_type": "bool", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "bool_three", + "db_type": "bool", + "default": "0", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "bool_four", + "db_type": "bool", + "default": "1", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "bool_five", + "db_type": "bool", + "default": "0", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "bool_six", + "db_type": "bool", + "default": "1", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "string_zero", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_one", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_two", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_three", + "db_type": "varchar", + "default": "a", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_four", + "db_type": "varchar", + "default": "b", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_five", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_six", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_seven", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_eight", + "db_type": "varchar", + "default": "abcdefgh", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_nine", + "db_type": "varchar", + "default": "abcdefgh", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_ten", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_eleven", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "big_int_zero", + "db_type": "bigint", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_one", + "db_type": "bigint", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_two", + "db_type": "bigint", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_three", + "db_type": "bigint", + "default": "111111", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_four", + "db_type": "bigint", + "default": "222222", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_five", + "db_type": "bigint", + "default": "0", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_six", + "db_type": "bigint", + "default": "0", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_seven", + "db_type": "bigint", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "uint64" + }, + { + "name": "big_int_eight", + "db_type": "bigint", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "uint64" + }, + { + "name": "int_zero", + "db_type": "int", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_one", + "db_type": "int", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_two", + "db_type": "int", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_three", + "db_type": "int", + "default": "333333", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_four", + "db_type": "int", + "default": "444444", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_five", + "db_type": "int", + "default": "0", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_six", + "db_type": "int", + "default": "0", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_seven", + "db_type": "int", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "uint32" + }, + { + "name": "int_eight", + "db_type": "int", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "uint32" + }, + { + "name": "float_zero", + "db_type": "float", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float32" + }, + { + "name": "float_one", + "db_type": "float", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float32" + }, + { + "name": "float_two", + "db_type": "float", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float32" + }, + { + "name": "float_three", + "db_type": "float", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float32" + }, + { + "name": "float_four", + "db_type": "float", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float32" + }, + { + "name": "float_five", + "db_type": "float", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float32" + }, + { + "name": "float_six", + "db_type": "float", + "default": "1.1", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float32" + }, + { + "name": "float_seven", + "db_type": "float", + "default": "1.1", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float32" + }, + { + "name": "float_eight", + "db_type": "float", + "default": "0.0", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float32" + }, + { + "name": "float_nine", + "db_type": "float", + "default": "0.0", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float32" + }, + { + "name": "bytea_zero", + "db_type": "binary", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_one", + "db_type": "binary", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_two", + "db_type": "binary", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_three", + "db_type": "binary", + "default": "0x61", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_four", + "db_type": "binary", + "default": "0x62", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_five", + "db_type": "binary", + "default": "0x616263646566676861626364656667686162636465666768", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_six", + "db_type": "binary", + "default": "0x686766656463626168676665646362616867666564636261", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_seven", + "db_type": "binary", + "default": "0x", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_eight", + "db_type": "binary", + "default": "0x", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "time_zero", + "db_type": "timestamp", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_one", + "db_type": "date", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_two", + "db_type": "timestamp", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_three", + "db_type": "timestamp", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_five", + "db_type": "timestamp", + "default": "CURRENT_TIMESTAMP", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_nine", + "db_type": "timestamp", + "default": "CURRENT_TIMESTAMP", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_eleven", + "db_type": "date", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_twelve", + "db_type": "date", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_fifteen", + "db_type": "date", + "default": "1999-01-08", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_sixteen", + "db_type": "date", + "default": "1999-01-08", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "json_null", + "db_type": "json", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "types.JSON[json.RawMessage]" + }, + { + "name": "json_nnull", + "db_type": "json", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "types.JSON[json.RawMessage]" + }, + { + "name": "tinyint_null", + "db_type": "tinyint", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int8" + }, + { + "name": "tinyint_nnull", + "db_type": "tinyint", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int8" + }, + { + "name": "tinyint1_null", + "db_type": "bool", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "tinyint1_nnull", + "db_type": "bool", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "tinyint2_null", + "db_type": "tinyint", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int8" + }, + { + "name": "tinyint2_nnull", + "db_type": "tinyint", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int8" + }, + { + "name": "smallint_null", + "db_type": "smallint", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int16" + }, + { + "name": "smallint_nnull", + "db_type": "smallint", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int16" + }, + { + "name": "mediumint_null", + "db_type": "mediumint", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "mediumint_nnull", + "db_type": "mediumint", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "bigint_null", + "db_type": "bigint", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "bigint_nnull", + "db_type": "bigint", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "float_null", + "db_type": "float", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float32" + }, + { + "name": "float_nnull", + "db_type": "float", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float32" + }, + { + "name": "double_null", + "db_type": "double", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float64" + }, + { + "name": "double_nnull", + "db_type": "double", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float64" + }, + { + "name": "doubleprec_null", + "db_type": "double", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float64" + }, + { + "name": "doubleprec_nnull", + "db_type": "double", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float64" + }, + { + "name": "real_null", + "db_type": "double", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float64" + }, + { + "name": "real_nnull", + "db_type": "double", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float64" + }, + { + "name": "boolean_null", + "db_type": "bool", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "boolean_nnull", + "db_type": "bool", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "date_null", + "db_type": "date", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "date_nnull", + "db_type": "date", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "datetime_null", + "db_type": "datetime", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "datetime_nnull", + "db_type": "datetime", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "timestamp_null", + "db_type": "timestamp", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "timestamp_nnull", + "db_type": "timestamp", + "default": "CURRENT_TIMESTAMP", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "binary_null", + "db_type": "binary", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "binary_nnull", + "db_type": "binary", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "varbinary_null", + "db_type": "varbinary", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "varbinary_nnull", + "db_type": "varbinary", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "tinyblob_null", + "db_type": "tinyblob", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "tinyblob_nnull", + "db_type": "tinyblob", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "blob_null", + "db_type": "blob", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "blob_nnull", + "db_type": "blob", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "mediumblob_null", + "db_type": "mediumblob", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "mediumblob_nnull", + "db_type": "mediumblob", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "longblob_null", + "db_type": "longblob", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "longblob_nnull", + "db_type": "longblob", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "varchar_null", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "varchar_nnull", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "char_null", + "db_type": "char", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "char_nnull", + "db_type": "char", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "text_null", + "db_type": "text", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "text_nnull", + "db_type": "text", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "virtual_nnull", + "db_type": "text", + "default": "AUTO_GENERATED", + "comment": "", + "nullable": false, + "generated": true, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "virtual_null", + "db_type": "text", + "default": "AUTO_GENERATED", + "comment": "", + "nullable": true, + "generated": true, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "generated_nnull", + "db_type": "text", + "default": "AUTO_GENERATED", + "comment": "", + "nullable": false, + "generated": true, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "generated_null", + "db_type": "text", + "default": "AUTO_GENERATED", + "comment": "", + "nullable": true, + "generated": true, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "int_one", + "columns": [ + "int_one", + "int_two" + ], + "expressions": null + }, + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": [ + { + "name": "int_one", + "columns": [ + "int_one", + "int_two" + ] + } + ] + } + }, + { + "key": "user_videos", + "schema": "", + "name": "user_videos", + "columns": [ + { + "name": "user_id", + "db_type": "int", + "default": "0", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "video_id", + "db_type": "int", + "default": "0", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "sponsor_id", + "db_type": "int", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + } + ], + "indexes": null, + "constraints": { + "primary": null, + "foreign": null, + "uniques": null + } + }, + { + "key": "users", + "schema": "", + "name": "users", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "video_tags", + "schema": "", + "name": "video_tags", + "columns": [ + { + "name": "video_id", + "db_type": "int", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "tag_id", + "db_type": "int", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "video_id", + "tag_id" + ], + "expressions": null + }, + { + "name": "tag_id", + "columns": [ + "tag_id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "video_id", + "tag_id" + ] + }, + "foreign": [ + { + "name": "video_tags_ibfk_1", + "columns": [ + "video_id" + ], + "foreign_table": "videos", + "foreign_columns": [ + "id" + ] + }, + { + "name": "video_tags_ibfk_2", + "columns": [ + "tag_id" + ], + "foreign_table": "tags", + "foreign_columns": [ + "id" + ] + } + ], + "uniques": null + } + }, + { + "key": "videos", + "schema": "", + "name": "videos", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + }, + { + "name": "user_id", + "db_type": "int", + "default": "", + "comment": "this is a comment", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "sponsor_id", + "db_type": "int", + "default": "", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + }, + { + "name": "sponsor_id", + "columns": [ + "sponsor_id" + ], + "expressions": null + }, + { + "name": "user_id", + "columns": [ + "user_id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": [ + { + "name": "videos_ibfk_1", + "columns": [ + "user_id" + ], + "foreign_table": "users", + "foreign_columns": [ + "id" + ] + }, + { + "name": "videos_ibfk_2", + "columns": [ + "sponsor_id" + ], + "foreign_table": "sponsors", + "foreign_columns": [ + "id" + ] + } + ], + "uniques": [ + { + "name": "sponsor_id", + "columns": [ + "sponsor_id" + ] + } + ] + } + } + ], + "enums": [ + { + "Type": "TypeMonstersEnumNullable", + "Values": [ + "monday", + "tuesday", + "wednesday", + "thursday", + "friday" + ] + }, + { + "Type": "TypeMonstersEnumUse", + "Values": [ + "monday", + "tuesday", + "wednesday", + "thursday", + "friday" + ] + } + ], + "extra_info": null, + "driver_name": "github.com/go-sql-driver/mysql" +} \ No newline at end of file diff --git a/gen/bobgen-mysql/driver/include-exclude-tables-mixed.golden.json b/gen/bobgen-mysql/driver/include-exclude-tables-mixed.golden.json new file mode 100644 index 00000000..8b2f8e31 --- /dev/null +++ b/gen/bobgen-mysql/driver/include-exclude-tables-mixed.golden.json @@ -0,0 +1,103 @@ +{ + "tables": [ + { + "key": "bar_baz", + "schema": "", + "name": "bar_baz", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "bar_qux", + "schema": "", + "name": "bar_qux", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + } + ], + "enums": null, + "extra_info": null, + "driver_name": "github.com/go-sql-driver/mysql" +} \ No newline at end of file diff --git a/gen/bobgen-mysql/driver/include-exclude-tables-regex.golden.json b/gen/bobgen-mysql/driver/include-exclude-tables-regex.golden.json new file mode 100644 index 00000000..f99c25d7 --- /dev/null +++ b/gen/bobgen-mysql/driver/include-exclude-tables-regex.golden.json @@ -0,0 +1,103 @@ +{ + "tables": [ + { + "key": "bar_qux", + "schema": "", + "name": "bar_qux", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "foo_qux", + "schema": "", + "name": "foo_qux", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + } + ], + "enums": null, + "extra_info": null, + "driver_name": "github.com/go-sql-driver/mysql" +} \ No newline at end of file diff --git a/gen/bobgen-mysql/driver/include-exclude-tables.golden.json b/gen/bobgen-mysql/driver/include-exclude-tables.golden.json new file mode 100644 index 00000000..f73cc301 --- /dev/null +++ b/gen/bobgen-mysql/driver/include-exclude-tables.golden.json @@ -0,0 +1,55 @@ +{ + "tables": [ + { + "key": "foo_baz", + "schema": "", + "name": "foo_baz", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + } + ], + "enums": null, + "extra_info": null, + "driver_name": "github.com/go-sql-driver/mysql" +} \ No newline at end of file diff --git a/gen/bobgen-mysql/driver/include-tables.golden.json b/gen/bobgen-mysql/driver/include-tables.golden.json new file mode 100644 index 00000000..2b12154d --- /dev/null +++ b/gen/bobgen-mysql/driver/include-tables.golden.json @@ -0,0 +1,103 @@ +{ + "tables": [ + { + "key": "foo_bar", + "schema": "", + "name": "foo_bar", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "foo_baz", + "schema": "", + "name": "foo_baz", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + } + ], + "enums": null, + "extra_info": null, + "driver_name": "github.com/go-sql-driver/mysql" +} \ No newline at end of file diff --git a/gen/bobgen-mysql/driver/mysql.go b/gen/bobgen-mysql/driver/mysql.go index 62eef2ed..05ec4685 100644 --- a/gen/bobgen-mysql/driver/mysql.go +++ b/gen/bobgen-mysql/driver/mysql.go @@ -124,17 +124,35 @@ func (d *driver) TablesInfo(ctx context.Context, tableFilter drivers.Filter) (dr exclude := tableFilter.Except if len(include) > 0 { - query += fmt.Sprintf(" and table_name in (%s)", strmangle.Placeholders(false, len(include), 1, 1)) // third param is not used for ? placeholders - for _, w := range include { - args = append(args, w) + var subqueries []string + stringPatterns, regexPatterns := tableFilter.ClassifyPatterns(include) + if len(stringPatterns) > 0 { + subqueries = append(subqueries, fmt.Sprintf("table_name in (%s)", strmangle.Placeholders(false, len(stringPatterns), 1, 1))) // third param is not used for ? placeholders + for _, w := range stringPatterns { + args = append(args, w) + } + } + if len(regexPatterns) > 0 { + subqueries = append(subqueries, "table_name regexp (?)") + args = append(args, strings.Join(regexPatterns, "|")) } + query += fmt.Sprintf(" and (%s)", strings.Join(subqueries, " or ")) } if len(exclude) > 0 { - query += fmt.Sprintf(" and table_name not in (%s)", strmangle.Placeholders(false, len(exclude), 1, 1)) // third param is not used for ? placeholders - for _, w := range exclude { - args = append(args, w) + var subqueries []string + stringPatterns, regexPatterns := tableFilter.ClassifyPatterns(exclude) + if len(stringPatterns) > 0 { + subqueries = append(subqueries, fmt.Sprintf("table_name not in (%s)", strmangle.Placeholders(false, len(stringPatterns), 1, 1))) // third param is not used for ? placeholders + for _, w := range stringPatterns { + args = append(args, w) + } + } + if len(regexPatterns) > 0 { + subqueries = append(subqueries, "table_name not regexp (?)") + args = append(args, strings.Join(regexPatterns, "|")) } + query += fmt.Sprintf(" and (%s)", strings.Join(subqueries, " and ")) } query += ` order by table_name;` diff --git a/gen/bobgen-mysql/driver/mysql.golden.json b/gen/bobgen-mysql/driver/mysql.golden.json index 64f346cc..8db2187a 100644 --- a/gen/bobgen-mysql/driver/mysql.golden.json +++ b/gen/bobgen-mysql/driver/mysql.golden.json @@ -1,5 +1,245 @@ { "tables": [ + { + "key": "bar_baz", + "schema": "", + "name": "bar_baz", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "bar_qux", + "schema": "", + "name": "bar_qux", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "foo_bar", + "schema": "", + "name": "foo_bar", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "foo_baz", + "schema": "", + "name": "foo_baz", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "foo_qux", + "schema": "", + "name": "foo_qux", + "columns": [ + { + "name": "id", + "db_type": "int", + "default": "AUTO_INCREMENT", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": true, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "varchar", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "PRIMARY", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, { "key": "multi_keys", "schema": "", @@ -1705,7 +1945,15 @@ ] }, "foreign": null, - "uniques": null + "uniques": [ + { + "name": "int_one", + "columns": [ + "int_one", + "int_two" + ] + } + ] } }, { diff --git a/gen/bobgen-mysql/driver/mysql_test.go b/gen/bobgen-mysql/driver/mysql_test.go index df9513d9..203205b3 100644 --- a/gen/bobgen-mysql/driver/mysql_test.go +++ b/gen/bobgen-mysql/driver/mysql_test.go @@ -87,6 +87,76 @@ func TestDriver(t *testing.T) { }, goldenJson: "mysql.golden.json", }, + { + name: "include tables", + config: Config{ + Dsn: dsn, + Only: map[string][]string{ + "foo_bar": nil, + "foo_baz": nil, + }, + }, + goldenJson: "include-tables.golden.json", + }, + { + name: "exclude tables", + config: Config{ + Dsn: dsn, + Except: map[string][]string{ + "foo_bar": nil, + "foo_baz": nil, + "*": {"secret_col"}, + }, + }, + goldenJson: "exclude-tables.golden.json", + }, + { + name: "include + exclude tables", + config: Config{ + Dsn: dsn, + Only: map[string][]string{ + "foo_bar": nil, + "foo_baz": nil, + }, + Except: map[string][]string{ + "foo_bar": nil, + "bar_baz": nil, + }, + }, + goldenJson: "include-exclude-tables.golden.json", + }, + { + name: "include + exclude tables regex", + config: Config{ + Dsn: dsn, + Only: map[string][]string{ + "/^foo/": nil, + "/^bar/": nil, + }, + Except: map[string][]string{ + "/bar$/": nil, + "/baz$/": nil, + }, + }, + goldenJson: "include-exclude-tables-regex.golden.json", + }, + { + name: "include + exclude tables mixed", + config: Config{ + Dsn: dsn, + Only: map[string][]string{ + "/^foo/": nil, + "bar_baz": nil, + "bar_qux": nil, + }, + Except: map[string][]string{ + "/bar$/": nil, + "foo_baz": nil, + "foo_qux": nil, + }, + }, + goldenJson: "include-exclude-tables-mixed.golden.json", + }, } for _, tt := range tests { diff --git a/gen/bobgen-psql/driver/exclude-tables.golden.json b/gen/bobgen-psql/driver/exclude-tables.golden.json new file mode 100644 index 00000000..090353da --- /dev/null +++ b/gen/bobgen-psql/driver/exclude-tables.golden.json @@ -0,0 +1,4251 @@ +{ + "tables": [ + { + "key": "bar_baz", + "schema": "", + "name": "bar_baz", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('bar_baz_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "bar_baz_pkey", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "bar_baz_pkey", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "bar_qux", + "schema": "", + "name": "bar_qux", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('bar_qux_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "bar_qux_pkey", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "bar_qux_pkey", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "foo_qux", + "schema": "", + "name": "foo_qux", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('foo_qux_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "foo_qux_pkey", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "foo_qux_pkey", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "sponsors", + "schema": "", + "name": "sponsors", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('sponsors_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "sponsors_pkey", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "sponsors_pkey", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "tags", + "schema": "", + "name": "tags", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('tags_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "tags_pkey", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "tags_pkey", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "test_index_expressions", + "schema": "", + "name": "test_index_expressions", + "columns": [ + { + "name": "col1", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "col2", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "col3", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "idx1", + "columns": null, + "expressions": [ + "(col1 + col2)" + ] + }, + { + "name": "idx2", + "columns": [ + "col3" + ], + "expressions": [ + "(col1 + col2)" + ] + }, + { + "name": "idx3", + "columns": [ + "col1" + ], + "expressions": [ + "(col2 + col3)" + ] + }, + { + "name": "idx4", + "columns": [ + "col3" + ], + "expressions": null + }, + { + "name": "idx5", + "columns": [ + "col1", + "col2" + ], + "expressions": null + }, + { + "name": "idx6", + "columns": null, + "expressions": [ + "pow(col3::double precision, 2::double precision)" + ] + } + ], + "constraints": { + "primary": null, + "foreign": null, + "uniques": null + } + }, + { + "key": "type_monsters", + "schema": "", + "name": "type_monsters", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('type_monsters_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "enum_use", + "db_type": "ENUM", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "UnicodeEnum" + }, + { + "name": "enum_nullable", + "db_type": "ENUM", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "UnicodeEnum" + }, + { + "name": "bool_zero", + "db_type": "boolean", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "bool_one", + "db_type": "boolean", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "bool_two", + "db_type": "boolean", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "bool_three", + "db_type": "boolean", + "default": "false", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "bool_four", + "db_type": "boolean", + "default": "true", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "bool_five", + "db_type": "boolean", + "default": "false", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "bool_six", + "db_type": "boolean", + "default": "true", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "string_zero", + "db_type": "character varying", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_one", + "db_type": "character varying", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_two", + "db_type": "character varying", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_three", + "db_type": "character varying", + "default": "'a'::character varying", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_four", + "db_type": "character varying", + "default": "'b'::character varying", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_five", + "db_type": "character varying", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_six", + "db_type": "character varying", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_seven", + "db_type": "character varying", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_eight", + "db_type": "character varying", + "default": "'abcdefgh'::character varying", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_nine", + "db_type": "character varying", + "default": "'abcdefgh'::character varying", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_ten", + "db_type": "character varying", + "default": "''::character varying", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_eleven", + "db_type": "character varying", + "default": "''::character varying", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_zero", + "db_type": "character", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_one", + "db_type": "character", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_two", + "db_type": "character", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_three", + "db_type": "character", + "default": "'a'::bpchar", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_four", + "db_type": "character", + "default": "'b'::bpchar", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_five", + "db_type": "character", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_six", + "db_type": "character", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_seven", + "db_type": "character", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_eight", + "db_type": "character", + "default": "'a'::bpchar", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_nine", + "db_type": "character", + "default": "'b'::bpchar", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "byte_zero", + "db_type": "\"char\"", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "byte_one", + "db_type": "\"char\"", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "byte_two", + "db_type": "\"char\"", + "default": "'a'::\"char\"", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "byte_three", + "db_type": "\"char\"", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "byte_four", + "db_type": "\"char\"", + "default": "'b'::\"char\"", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "big_int_zero", + "db_type": "bigint", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_one", + "db_type": "bigint", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_two", + "db_type": "bigint", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_three", + "db_type": "bigint", + "default": "111111", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_four", + "db_type": "bigint", + "default": "222222", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_five", + "db_type": "bigint", + "default": "0", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_six", + "db_type": "bigint", + "default": "0", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "int_zero", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_one", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_two", + "db_type": "integer", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_three", + "db_type": "integer", + "default": "333333", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_four", + "db_type": "integer", + "default": "444444", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_five", + "db_type": "integer", + "default": "0", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_six", + "db_type": "integer", + "default": "0", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "float_zero", + "db_type": "numeric", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "float_one", + "db_type": "numeric", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "float_two", + "db_type": "numeric", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "float_three", + "db_type": "numeric", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "float_four", + "db_type": "numeric", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "float_five", + "db_type": "numeric", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "float_six", + "db_type": "numeric", + "default": "1.1", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "float_seven", + "db_type": "numeric", + "default": "1.1", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "float_eight", + "db_type": "numeric", + "default": "0.0", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "float_nine", + "db_type": "numeric", + "default": "0.0", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "bytea_zero", + "db_type": "bytea", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_one", + "db_type": "bytea", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_two", + "db_type": "bytea", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_three", + "db_type": "bytea", + "default": "'\\x61'::bytea", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_four", + "db_type": "bytea", + "default": "'\\x62'::bytea", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_five", + "db_type": "bytea", + "default": "'\\x616263646566676861626364656667686162636465666768'::bytea", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_six", + "db_type": "bytea", + "default": "'\\x686766656463626168676665646362616867666564636261'::bytea", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_seven", + "db_type": "bytea", + "default": "'\\x'::bytea", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_eight", + "db_type": "bytea", + "default": "'\\x'::bytea", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "time_zero", + "db_type": "timestamp without time zone", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_one", + "db_type": "date", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_two", + "db_type": "timestamp without time zone", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_three", + "db_type": "timestamp without time zone", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_four", + "db_type": "timestamp without time zone", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_five", + "db_type": "timestamp without time zone", + "default": "'1999-01-08 04:05:06.789'::timestamp without time zone", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_six", + "db_type": "timestamp without time zone", + "default": "'1999-01-08 04:05:06.789'::timestamp without time zone", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_seven", + "db_type": "timestamp without time zone", + "default": "'1999-01-08 04:05:06'::timestamp without time zone", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_eight", + "db_type": "timestamp without time zone", + "default": "'1999-01-08 04:05:06.789'::timestamp without time zone", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_nine", + "db_type": "timestamp without time zone", + "default": "'1999-01-08 04:05:06.789'::timestamp without time zone", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_ten", + "db_type": "timestamp without time zone", + "default": "'1999-01-08 04:05:06'::timestamp without time zone", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_eleven", + "db_type": "date", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_twelve", + "db_type": "date", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_thirteen", + "db_type": "date", + "default": "'1999-01-08'::date", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_fourteen", + "db_type": "date", + "default": "'1999-01-08'::date", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_fifteen", + "db_type": "date", + "default": "'1999-01-08'::date", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_sixteen", + "db_type": "date", + "default": "'1999-01-08'::date", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_seventeen", + "db_type": "date", + "default": "'1999-01-08'::date", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_eighteen", + "db_type": "date", + "default": "'1999-01-08'::date", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "uuid_zero", + "db_type": "uuid", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "uuid.UUID" + }, + { + "name": "uuid_one", + "db_type": "uuid", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "uuid.UUID" + }, + { + "name": "uuid_two", + "db_type": "uuid", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "uuid.UUID" + }, + { + "name": "uuid_three", + "db_type": "uuid", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "uuid.UUID" + }, + { + "name": "uuid_four", + "db_type": "uuid", + "default": "'6ba7b810-9dad-11d1-80b4-00c04fd430c8'::uuid", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "uuid.UUID" + }, + { + "name": "uuid_five", + "db_type": "uuid", + "default": "'6ba7b810-9dad-11d1-80b4-00c04fd430c8'::uuid", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "uuid.UUID" + }, + { + "name": "integer_default", + "db_type": "integer", + "default": "5", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "varchar_default", + "db_type": "character varying", + "default": "(5)::character varying", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "timestamp_notz", + "db_type": "timestamp without time zone", + "default": "(now() AT TIME ZONE 'utc'::text)", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "timestamp_tz", + "db_type": "timestamp with time zone", + "default": "(now() AT TIME ZONE 'utc'::text)", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "interval_nnull", + "db_type": "interval", + "default": "'21 days'::interval", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "interval_null", + "db_type": "interval", + "default": "'23:00:00'::interval", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "json_null", + "db_type": "json", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "types.JSON[json.RawMessage]" + }, + { + "name": "json_nnull", + "db_type": "json", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "types.JSON[json.RawMessage]" + }, + { + "name": "jsonb_null", + "db_type": "jsonb", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "types.JSON[json.RawMessage]" + }, + { + "name": "jsonb_nnull", + "db_type": "jsonb", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "types.JSON[json.RawMessage]" + }, + { + "name": "box_null", + "db_type": "box", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Box" + }, + { + "name": "box_nnull", + "db_type": "box", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Box" + }, + { + "name": "cidr_null", + "db_type": "cidr", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "types.Text[netip.Addr, *netip.Addr]" + }, + { + "name": "cidr_nnull", + "db_type": "cidr", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "types.Text[netip.Addr, *netip.Addr]" + }, + { + "name": "circle_null", + "db_type": "circle", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Circle" + }, + { + "name": "circle_nnull", + "db_type": "circle", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Circle" + }, + { + "name": "double_prec_null", + "db_type": "double precision", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float64" + }, + { + "name": "double_prec_nnull", + "db_type": "double precision", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float64" + }, + { + "name": "inet_null", + "db_type": "inet", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.Inet" + }, + { + "name": "inet_nnull", + "db_type": "inet", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.Inet" + }, + { + "name": "line_null", + "db_type": "line", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Line" + }, + { + "name": "line_nnull", + "db_type": "line", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Line" + }, + { + "name": "lseg_null", + "db_type": "lseg", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Lseg" + }, + { + "name": "lseg_nnull", + "db_type": "lseg", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Lseg" + }, + { + "name": "macaddr_null", + "db_type": "macaddr", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.Macaddr" + }, + { + "name": "macaddr_nnull", + "db_type": "macaddr", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.Macaddr" + }, + { + "name": "money_null", + "db_type": "money", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "money_nnull", + "db_type": "money", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "path_null", + "db_type": "path", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Path" + }, + { + "name": "path_nnull", + "db_type": "path", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Path" + }, + { + "name": "pg_lsn_null", + "db_type": "pg_lsn", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.LSN" + }, + { + "name": "pg_lsn_nnull", + "db_type": "pg_lsn", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.LSN" + }, + { + "name": "point_null", + "db_type": "point", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Point" + }, + { + "name": "point_nnull", + "db_type": "point", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Point" + }, + { + "name": "polygon_null", + "db_type": "polygon", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Polygon" + }, + { + "name": "polygon_nnull", + "db_type": "polygon", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Polygon" + }, + { + "name": "tsquery_null", + "db_type": "tsquery", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "tsquery_nnull", + "db_type": "tsquery", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "tsvector_null", + "db_type": "tsvector", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "tsvector_nnull", + "db_type": "tsvector", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "txid_null", + "db_type": "txid_snapshot", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.TxIDSnapshot" + }, + { + "name": "txid_nnull", + "db_type": "txid_snapshot", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.TxIDSnapshot" + }, + { + "name": "xml_null", + "db_type": "xml", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "xml" + }, + { + "name": "xml_nnull", + "db_type": "xml", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "xml" + }, + { + "name": "intarr_null", + "db_type": "integer[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.Int64Array" + }, + { + "name": "intarr_nnull", + "db_type": "integer[]", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.Int64Array" + }, + { + "name": "boolarr_null", + "db_type": "boolean[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.BoolArray" + }, + { + "name": "boolarr_nnull", + "db_type": "boolean[]", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.BoolArray" + }, + { + "name": "varchararr_null", + "db_type": "character varying[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.StringArray" + }, + { + "name": "varchararr_nnull", + "db_type": "character varying[]", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.StringArray" + }, + { + "name": "decimalarr_null", + "db_type": "numeric[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.Array[decimal.Decimal]" + }, + { + "name": "decimalarr_nnull", + "db_type": "numeric[]", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.Array[decimal.Decimal]" + }, + { + "name": "byteaarr_null", + "db_type": "bytea[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.ByteaArray" + }, + { + "name": "byteaarr_nnull", + "db_type": "bytea[]", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.ByteaArray" + }, + { + "name": "jsonbarr_null", + "db_type": "jsonb[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.StringArray" + }, + { + "name": "jsonbarr_nnull", + "db_type": "jsonb[]", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.StringArray" + }, + { + "name": "jsonarr_null", + "db_type": "json[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.StringArray" + }, + { + "name": "jsonarr_nnull", + "db_type": "json[]", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.StringArray" + }, + { + "name": "enumarr_null", + "db_type": "_unicode_enum[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.EnumArray[UnicodeEnum]" + }, + { + "name": "enumarr_nnull", + "db_type": "_unicode_enum[]", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.EnumArray[UnicodeEnum]" + }, + { + "name": "customarr_null", + "db_type": "_int4[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "my_int_array", + "type": "pq.Int64Array" + }, + { + "name": "customarr_nnull", + "db_type": "_int4[]", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "my_int_array", + "type": "pq.Int64Array" + }, + { + "name": "domainuint3_nnull", + "db_type": "numeric", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "uint3", + "type": "decimal.Decimal" + }, + { + "name": "base", + "db_type": "text", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "generated_nnull", + "db_type": "text", + "default": "GENERATED", + "comment": "", + "nullable": false, + "generated": true, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "generated_null", + "db_type": "text", + "default": "GENERATED", + "comment": "", + "nullable": true, + "generated": true, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "type_monsters_pkey", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "type_monsters_pkey", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "type_monsters_mv", + "schema": "", + "name": "type_monsters_mv", + "columns": null, + "indexes": null, + "constraints": { + "primary": null, + "foreign": null, + "uniques": null + } + }, + { + "key": "type_monsters_v", + "schema": "", + "name": "type_monsters_v", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "enum_use", + "db_type": "ENUM", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "UnicodeEnum" + }, + { + "name": "enum_nullable", + "db_type": "ENUM", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "UnicodeEnum" + }, + { + "name": "bool_zero", + "db_type": "boolean", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "bool_one", + "db_type": "boolean", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "bool_two", + "db_type": "boolean", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "bool_three", + "db_type": "boolean", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "bool_four", + "db_type": "boolean", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "bool_five", + "db_type": "boolean", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "bool_six", + "db_type": "boolean", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "string_zero", + "db_type": "character varying", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_one", + "db_type": "character varying", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_two", + "db_type": "character varying", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_three", + "db_type": "character varying", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_four", + "db_type": "character varying", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_five", + "db_type": "character varying", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_six", + "db_type": "character varying", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_seven", + "db_type": "character varying", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_eight", + "db_type": "character varying", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_nine", + "db_type": "character varying", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_ten", + "db_type": "character varying", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "string_eleven", + "db_type": "character varying", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_zero", + "db_type": "character", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_one", + "db_type": "character", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_two", + "db_type": "character", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_three", + "db_type": "character", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_four", + "db_type": "character", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_five", + "db_type": "character", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_six", + "db_type": "character", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_seven", + "db_type": "character", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_eight", + "db_type": "character", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "nonbyte_nine", + "db_type": "character", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "byte_zero", + "db_type": "\"char\"", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "byte_one", + "db_type": "\"char\"", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "byte_two", + "db_type": "\"char\"", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "byte_three", + "db_type": "\"char\"", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "byte_four", + "db_type": "\"char\"", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "big_int_zero", + "db_type": "bigint", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_one", + "db_type": "bigint", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_two", + "db_type": "bigint", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_three", + "db_type": "bigint", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_four", + "db_type": "bigint", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_five", + "db_type": "bigint", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "big_int_six", + "db_type": "bigint", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int64" + }, + { + "name": "int_zero", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_one", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_two", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_three", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_four", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_five", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "int_six", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "float_zero", + "db_type": "numeric", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "float_one", + "db_type": "numeric", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "float_two", + "db_type": "numeric", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "float_three", + "db_type": "numeric", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "float_four", + "db_type": "numeric", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "float_five", + "db_type": "numeric", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "float_six", + "db_type": "numeric", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "float_seven", + "db_type": "numeric", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "float_eight", + "db_type": "numeric", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "float_nine", + "db_type": "numeric", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "bytea_zero", + "db_type": "bytea", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_one", + "db_type": "bytea", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_two", + "db_type": "bytea", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_three", + "db_type": "bytea", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_four", + "db_type": "bytea", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_five", + "db_type": "bytea", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_six", + "db_type": "bytea", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_seven", + "db_type": "bytea", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "bytea_eight", + "db_type": "bytea", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "[]byte" + }, + { + "name": "time_zero", + "db_type": "timestamp without time zone", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_one", + "db_type": "date", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_two", + "db_type": "timestamp without time zone", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_three", + "db_type": "timestamp without time zone", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_four", + "db_type": "timestamp without time zone", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_five", + "db_type": "timestamp without time zone", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_six", + "db_type": "timestamp without time zone", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_seven", + "db_type": "timestamp without time zone", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_eight", + "db_type": "timestamp without time zone", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_nine", + "db_type": "timestamp without time zone", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_ten", + "db_type": "timestamp without time zone", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_eleven", + "db_type": "date", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_twelve", + "db_type": "date", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_thirteen", + "db_type": "date", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_fourteen", + "db_type": "date", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_fifteen", + "db_type": "date", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_sixteen", + "db_type": "date", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_seventeen", + "db_type": "date", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "time_eighteen", + "db_type": "date", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "uuid_zero", + "db_type": "uuid", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "uuid.UUID" + }, + { + "name": "uuid_one", + "db_type": "uuid", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "uuid.UUID" + }, + { + "name": "uuid_two", + "db_type": "uuid", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "uuid.UUID" + }, + { + "name": "uuid_three", + "db_type": "uuid", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "uuid.UUID" + }, + { + "name": "uuid_four", + "db_type": "uuid", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "uuid.UUID" + }, + { + "name": "uuid_five", + "db_type": "uuid", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "uuid.UUID" + }, + { + "name": "integer_default", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "varchar_default", + "db_type": "character varying", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "timestamp_notz", + "db_type": "timestamp without time zone", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "timestamp_tz", + "db_type": "timestamp with time zone", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "time.Time" + }, + { + "name": "interval_nnull", + "db_type": "interval", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "interval_null", + "db_type": "interval", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "json_null", + "db_type": "json", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "types.JSON[json.RawMessage]" + }, + { + "name": "json_nnull", + "db_type": "json", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "types.JSON[json.RawMessage]" + }, + { + "name": "jsonb_null", + "db_type": "jsonb", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "types.JSON[json.RawMessage]" + }, + { + "name": "jsonb_nnull", + "db_type": "jsonb", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "types.JSON[json.RawMessage]" + }, + { + "name": "box_null", + "db_type": "box", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Box" + }, + { + "name": "box_nnull", + "db_type": "box", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Box" + }, + { + "name": "cidr_null", + "db_type": "cidr", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "types.Text[netip.Addr, *netip.Addr]" + }, + { + "name": "cidr_nnull", + "db_type": "cidr", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "types.Text[netip.Addr, *netip.Addr]" + }, + { + "name": "circle_null", + "db_type": "circle", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Circle" + }, + { + "name": "circle_nnull", + "db_type": "circle", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Circle" + }, + { + "name": "double_prec_null", + "db_type": "double precision", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float64" + }, + { + "name": "double_prec_nnull", + "db_type": "double precision", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "float64" + }, + { + "name": "inet_null", + "db_type": "inet", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.Inet" + }, + { + "name": "inet_nnull", + "db_type": "inet", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.Inet" + }, + { + "name": "line_null", + "db_type": "line", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Line" + }, + { + "name": "line_nnull", + "db_type": "line", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Line" + }, + { + "name": "lseg_null", + "db_type": "lseg", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Lseg" + }, + { + "name": "lseg_nnull", + "db_type": "lseg", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Lseg" + }, + { + "name": "macaddr_null", + "db_type": "macaddr", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.Macaddr" + }, + { + "name": "macaddr_nnull", + "db_type": "macaddr", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.Macaddr" + }, + { + "name": "money_null", + "db_type": "money", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "money_nnull", + "db_type": "money", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "decimal.Decimal" + }, + { + "name": "path_null", + "db_type": "path", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Path" + }, + { + "name": "path_nnull", + "db_type": "path", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Path" + }, + { + "name": "pg_lsn_null", + "db_type": "pg_lsn", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.LSN" + }, + { + "name": "pg_lsn_nnull", + "db_type": "pg_lsn", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.LSN" + }, + { + "name": "point_null", + "db_type": "point", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Point" + }, + { + "name": "point_nnull", + "db_type": "point", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Point" + }, + { + "name": "polygon_null", + "db_type": "polygon", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Polygon" + }, + { + "name": "polygon_nnull", + "db_type": "polygon", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgeo.Polygon" + }, + { + "name": "tsquery_null", + "db_type": "tsquery", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "tsquery_nnull", + "db_type": "tsquery", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "tsvector_null", + "db_type": "tsvector", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "tsvector_nnull", + "db_type": "tsvector", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "txid_null", + "db_type": "txid_snapshot", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.TxIDSnapshot" + }, + { + "name": "txid_nnull", + "db_type": "txid_snapshot", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.TxIDSnapshot" + }, + { + "name": "xml_null", + "db_type": "xml", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "xml" + }, + { + "name": "xml_nnull", + "db_type": "xml", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "xml" + }, + { + "name": "intarr_null", + "db_type": "integer[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.Int64Array" + }, + { + "name": "intarr_nnull", + "db_type": "integer[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.Int64Array" + }, + { + "name": "boolarr_null", + "db_type": "boolean[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.BoolArray" + }, + { + "name": "boolarr_nnull", + "db_type": "boolean[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.BoolArray" + }, + { + "name": "varchararr_null", + "db_type": "character varying[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.StringArray" + }, + { + "name": "varchararr_nnull", + "db_type": "character varying[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.StringArray" + }, + { + "name": "decimalarr_null", + "db_type": "numeric[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.Array[decimal.Decimal]" + }, + { + "name": "decimalarr_nnull", + "db_type": "numeric[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.Array[decimal.Decimal]" + }, + { + "name": "byteaarr_null", + "db_type": "bytea[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.ByteaArray" + }, + { + "name": "byteaarr_nnull", + "db_type": "bytea[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.ByteaArray" + }, + { + "name": "jsonbarr_null", + "db_type": "jsonb[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.StringArray" + }, + { + "name": "jsonbarr_nnull", + "db_type": "jsonb[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.StringArray" + }, + { + "name": "jsonarr_null", + "db_type": "json[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.StringArray" + }, + { + "name": "jsonarr_nnull", + "db_type": "json[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pq.StringArray" + }, + { + "name": "enumarr_null", + "db_type": "_unicode_enum[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.EnumArray[UnicodeEnum]" + }, + { + "name": "enumarr_nnull", + "db_type": "_unicode_enum[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "pgtypes.EnumArray[UnicodeEnum]" + }, + { + "name": "customarr_null", + "db_type": "_int4[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "my_int_array", + "type": "pq.Int64Array" + }, + { + "name": "customarr_nnull", + "db_type": "_int4[]", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "my_int_array", + "type": "pq.Int64Array" + }, + { + "name": "domainuint3_nnull", + "db_type": "numeric", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "uint3", + "type": "decimal.Decimal" + }, + { + "name": "base", + "db_type": "text", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "generated_nnull", + "db_type": "text", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "generated_null", + "db_type": "text", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": null, + "constraints": { + "primary": null, + "foreign": null, + "uniques": null + } + }, + { + "key": "user_videos", + "schema": "", + "name": "user_videos", + "columns": [ + { + "name": "user_id", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "video_id", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "sponsor_id", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + } + ], + "indexes": null, + "constraints": { + "primary": null, + "foreign": null, + "uniques": null + } + }, + { + "key": "users", + "schema": "", + "name": "users", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('users_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "email_validated", + "db_type": "boolean", + "default": "false", + "comment": "Has the email address been tested?", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "bool" + }, + { + "name": "primary_email", + "db_type": "character varying", + "default": "NULL", + "comment": "The user's preferred email address.\n\nUse this to send emails to the user.", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + }, + { + "name": "parent_id", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "party_id", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "referrer", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "users_party_id_key", + "columns": [ + "party_id" + ], + "expressions": null + }, + { + "name": "users_pkey", + "columns": [ + "id" + ], + "expressions": null + }, + { + "name": "users_primary_email_key", + "columns": [ + "primary_email" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "users_pkey", + "columns": [ + "id" + ] + }, + "foreign": [ + { + "name": "users.users_parent_id_fkey", + "columns": [ + "parent_id" + ], + "foreign_table": "users", + "foreign_columns": [ + "id" + ] + }, + { + "name": "users.users_party_id_fkey", + "columns": [ + "party_id" + ], + "foreign_table": "users", + "foreign_columns": [ + "id" + ] + }, + { + "name": "users.users_referrer_fkey", + "columns": [ + "referrer" + ], + "foreign_table": "users", + "foreign_columns": [ + "id" + ] + } + ], + "uniques": [ + { + "name": "users_party_id_key", + "columns": [ + "party_id" + ] + }, + { + "name": "users_primary_email_key", + "columns": [ + "primary_email" + ] + } + ] + } + }, + { + "key": "video_tags", + "schema": "", + "name": "video_tags", + "columns": [ + { + "name": "video_id", + "db_type": "integer", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "tag_id", + "db_type": "integer", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "video_tags_pkey", + "columns": [ + "video_id", + "tag_id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "video_tags_pkey", + "columns": [ + "video_id", + "tag_id" + ] + }, + "foreign": [ + { + "name": "video_tags.video_tags_tag_id_fkey", + "columns": [ + "tag_id" + ], + "foreign_table": "tags", + "foreign_columns": [ + "id" + ] + }, + { + "name": "video_tags.video_tags_video_id_fkey", + "columns": [ + "video_id" + ], + "foreign_table": "videos", + "foreign_columns": [ + "id" + ] + } + ], + "uniques": null + } + }, + { + "key": "videos", + "schema": "", + "name": "videos", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('videos_id_seq'::regclass)", + "comment": "The ID of the video", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "user_id", + "db_type": "integer", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "sponsor_id", + "db_type": "integer", + "default": "NULL", + "comment": "", + "nullable": true, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + } + ], + "indexes": [ + { + "name": "videos_pkey", + "columns": [ + "id" + ], + "expressions": null + }, + { + "name": "videos_sponsor_id_key", + "columns": [ + "sponsor_id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "videos_pkey", + "columns": [ + "id" + ] + }, + "foreign": [ + { + "name": "videos.videos_sponsor_id_fkey", + "columns": [ + "sponsor_id" + ], + "foreign_table": "sponsors", + "foreign_columns": [ + "id" + ] + }, + { + "name": "videos.videos_user_id_fkey", + "columns": [ + "user_id" + ], + "foreign_table": "users", + "foreign_columns": [ + "id" + ] + } + ], + "uniques": [ + { + "name": "videos_sponsor_id_key", + "columns": [ + "sponsor_id" + ] + } + ] + } + } + ], + "enums": [ + { + "Type": "UnicodeEnum", + "Values": [ + "hello", + "привет", + "こんにちは", + "안녕하세요", + "hello_with_underscore" + ] + } + ], + "extra_info": null, + "driver_name": "github.com/lib/pq" +} \ No newline at end of file diff --git a/gen/bobgen-psql/driver/include-exclude-tables-mixed.golden.json b/gen/bobgen-psql/driver/include-exclude-tables-mixed.golden.json new file mode 100644 index 00000000..ec4b821b --- /dev/null +++ b/gen/bobgen-psql/driver/include-exclude-tables-mixed.golden.json @@ -0,0 +1,114 @@ +{ + "tables": [ + { + "key": "bar_baz", + "schema": "", + "name": "bar_baz", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('bar_baz_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "character varying", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "bar_baz_pkey", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "bar_baz_pkey", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "bar_qux", + "schema": "", + "name": "bar_qux", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('bar_qux_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "character varying", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "bar_qux_pkey", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "bar_qux_pkey", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + } + ], + "enums": [ + { + "Type": "UnicodeEnum", + "Values": [ + "hello", + "привет", + "こんにちは", + "안녕하세요", + "hello_with_underscore" + ] + } + ], + "extra_info": null, + "driver_name": "github.com/lib/pq" +} \ No newline at end of file diff --git a/gen/bobgen-psql/driver/include-exclude-tables-regex.golden.json b/gen/bobgen-psql/driver/include-exclude-tables-regex.golden.json new file mode 100644 index 00000000..352eb706 --- /dev/null +++ b/gen/bobgen-psql/driver/include-exclude-tables-regex.golden.json @@ -0,0 +1,114 @@ +{ + "tables": [ + { + "key": "bar_qux", + "schema": "", + "name": "bar_qux", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('bar_qux_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "character varying", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "bar_qux_pkey", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "bar_qux_pkey", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "foo_qux", + "schema": "", + "name": "foo_qux", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('foo_qux_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "character varying", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "foo_qux_pkey", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "foo_qux_pkey", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + } + ], + "enums": [ + { + "Type": "UnicodeEnum", + "Values": [ + "hello", + "привет", + "こんにちは", + "안녕하세요", + "hello_with_underscore" + ] + } + ], + "extra_info": null, + "driver_name": "github.com/lib/pq" +} \ No newline at end of file diff --git a/gen/bobgen-psql/driver/include-exclude-tables.golden.json b/gen/bobgen-psql/driver/include-exclude-tables.golden.json new file mode 100644 index 00000000..94107b1f --- /dev/null +++ b/gen/bobgen-psql/driver/include-exclude-tables.golden.json @@ -0,0 +1,66 @@ +{ + "tables": [ + { + "key": "foo_baz", + "schema": "", + "name": "foo_baz", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('foo_baz_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "character varying", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "foo_baz_pkey", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "foo_baz_pkey", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + } + ], + "enums": [ + { + "Type": "UnicodeEnum", + "Values": [ + "hello", + "привет", + "こんにちは", + "안녕하세요", + "hello_with_underscore" + ] + } + ], + "extra_info": null, + "driver_name": "github.com/lib/pq" +} \ No newline at end of file diff --git a/gen/bobgen-psql/driver/include-tables.golden.json b/gen/bobgen-psql/driver/include-tables.golden.json new file mode 100644 index 00000000..9044b37d --- /dev/null +++ b/gen/bobgen-psql/driver/include-tables.golden.json @@ -0,0 +1,114 @@ +{ + "tables": [ + { + "key": "foo_bar", + "schema": "", + "name": "foo_bar", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('foo_bar_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "character varying", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "foo_bar_pkey", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "foo_bar_pkey", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "foo_baz", + "schema": "", + "name": "foo_baz", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('foo_baz_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "character varying", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "foo_baz_pkey", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "foo_baz_pkey", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + } + ], + "enums": [ + { + "Type": "UnicodeEnum", + "Values": [ + "hello", + "привет", + "こんにちは", + "안녕하세요", + "hello_with_underscore" + ] + } + ], + "extra_info": null, + "driver_name": "github.com/lib/pq" +} \ No newline at end of file diff --git a/gen/bobgen-psql/driver/psql.go b/gen/bobgen-psql/driver/psql.go index 864643c8..b7a52527 100644 --- a/gen/bobgen-psql/driver/psql.go +++ b/gen/bobgen-psql/driver/psql.go @@ -6,6 +6,7 @@ import ( "fmt" "regexp" "sort" + "strings" "github.com/lib/pq" helpers "github.com/stephenafamo/bob/gen/bobgen-helpers" @@ -195,17 +196,35 @@ func (d *driver) TablesInfo(ctx context.Context, tableFilter drivers.Filter) (dr exclude := tableFilter.Except if len(include) > 0 { - query += fmt.Sprintf(" and %s in (%s)", keyClause, strmangle.Placeholders(true, len(include), 3, 1)) - for _, w := range include { - args = append(args, w) + var subqueries []string + stringPatterns, regexPatterns := tableFilter.ClassifyPatterns(include) + if len(stringPatterns) > 0 { + subqueries = append(subqueries, fmt.Sprintf("%s in (%s)", keyClause, strmangle.Placeholders(true, len(stringPatterns), len(args)+1, 1))) + for _, w := range stringPatterns { + args = append(args, w) + } + } + if len(regexPatterns) > 0 { + subqueries = append(subqueries, fmt.Sprintf("%s ~ (%s)", keyClause, strmangle.Placeholders(true, 1, len(args)+1, 1))) + args = append(args, strings.Join(regexPatterns, "|")) } + query += fmt.Sprintf(" and (%s)", strings.Join(subqueries, " or ")) } if len(exclude) > 0 { - query += fmt.Sprintf(" and %s not in (%s)", keyClause, strmangle.Placeholders(true, len(exclude), 3+len(include), 1)) - for _, w := range exclude { - args = append(args, w) + var subqueries []string + stringPatterns, regexPatterns := tableFilter.ClassifyPatterns(exclude) + if len(stringPatterns) > 0 { + subqueries = append(subqueries, fmt.Sprintf("%s not in (%s)", keyClause, strmangle.Placeholders(true, len(stringPatterns), len(args)+1, 1))) + for _, w := range stringPatterns { + args = append(args, w) + } + } + if len(regexPatterns) > 0 { + subqueries = append(subqueries, fmt.Sprintf("%s !~ (%s)", keyClause, strmangle.Placeholders(true, 1, len(args)+1, 1))) + args = append(args, strings.Join(regexPatterns, "|")) } + query += fmt.Sprintf(" and (%s)", strings.Join(subqueries, " and ")) } query += ` order by table_name;` diff --git a/gen/bobgen-psql/driver/psql.golden.json b/gen/bobgen-psql/driver/psql.golden.json index f40b1efe..0aa2aeaf 100644 --- a/gen/bobgen-psql/driver/psql.golden.json +++ b/gen/bobgen-psql/driver/psql.golden.json @@ -1,5 +1,245 @@ { "tables": [ + { + "key": "bar_baz", + "schema": "", + "name": "bar_baz", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('bar_baz_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "character varying", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "bar_baz_pkey", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "bar_baz_pkey", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "bar_qux", + "schema": "", + "name": "bar_qux", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('bar_qux_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "character varying", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "bar_qux_pkey", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "bar_qux_pkey", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "foo_bar", + "schema": "", + "name": "foo_bar", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('foo_bar_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "character varying", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "foo_bar_pkey", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "foo_bar_pkey", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "foo_baz", + "schema": "", + "name": "foo_baz", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('foo_baz_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "character varying", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "foo_baz_pkey", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "foo_baz_pkey", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, + { + "key": "foo_qux", + "schema": "", + "name": "foo_qux", + "columns": [ + { + "name": "id", + "db_type": "integer", + "default": "nextval('foo_qux_id_seq'::regclass)", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "int32" + }, + { + "name": "secret_col", + "db_type": "character varying", + "default": "", + "comment": "", + "nullable": false, + "generated": false, + "autoincr": false, + "domain_name": "", + "type": "string" + } + ], + "indexes": [ + { + "name": "foo_qux_pkey", + "columns": [ + "id" + ], + "expressions": null + } + ], + "constraints": { + "primary": { + "name": "foo_qux_pkey", + "columns": [ + "id" + ] + }, + "foreign": null, + "uniques": null + } + }, { "key": "sponsors", "schema": "", diff --git a/gen/bobgen-psql/driver/psql_test.go b/gen/bobgen-psql/driver/psql_test.go index 4eb6535d..173e4a23 100644 --- a/gen/bobgen-psql/driver/psql_test.go +++ b/gen/bobgen-psql/driver/psql_test.go @@ -69,6 +69,76 @@ func TestDriver(t *testing.T) { }, goldenJson: "psql.golden.json", }, + { + name: "include tables", + config: Config{ + Dsn: dsn, + Only: map[string][]string{ + "foo_bar": nil, + "foo_baz": nil, + }, + }, + goldenJson: "include-tables.golden.json", + }, + { + name: "exclude tables", + config: Config{ + Dsn: dsn, + Except: map[string][]string{ + "foo_bar": nil, + "foo_baz": nil, + "*": {"secret_col"}, + }, + }, + goldenJson: "exclude-tables.golden.json", + }, + { + name: "include + exclude tables", + config: Config{ + Dsn: dsn, + Only: map[string][]string{ + "foo_bar": nil, + "foo_baz": nil, + }, + Except: map[string][]string{ + "foo_bar": nil, + "bar_baz": nil, + }, + }, + goldenJson: "include-exclude-tables.golden.json", + }, + { + name: "include + exclude tables regex", + config: Config{ + Dsn: dsn, + Only: map[string][]string{ + "/^foo/": nil, + "/^bar/": nil, + }, + Except: map[string][]string{ + "/bar$/": nil, + "/baz$/": nil, + }, + }, + goldenJson: "include-exclude-tables-regex.golden.json", + }, + { + name: "include + exclude tables mixed", + config: Config{ + Dsn: dsn, + Only: map[string][]string{ + "/^foo/": nil, + "bar_baz": nil, + "bar_qux": nil, + }, + Except: map[string][]string{ + "/bar$/": nil, + "foo_baz": nil, + "foo_qux": nil, + }, + }, + goldenJson: "include-exclude-tables-mixed.golden.json", + }, } for _, tt := range tests { diff --git a/gen/drivers/table.go b/gen/drivers/table.go index 01de59df..59427906 100644 --- a/gen/drivers/table.go +++ b/gen/drivers/table.go @@ -2,6 +2,7 @@ package drivers import ( "fmt" + "strings" ) // Table metadata from the database schema. @@ -75,6 +76,25 @@ type Filter struct { Except []string } +func (f Filter) ClassifyPatterns(patterns []string) ([]string, []string) { + const regexDelimiter = "/" + var stringPatterns, regexPatterns []string //nolint:prealloc + + for _, pattern := range patterns { + if f.isRegexPattern(pattern, regexDelimiter) { + regexPatterns = append(regexPatterns, strings.Trim(pattern, regexDelimiter)) + continue + } + stringPatterns = append(stringPatterns, pattern) + } + + return stringPatterns, regexPatterns +} + +func (f Filter) isRegexPattern(pattern, delimiter string) bool { + return strings.HasPrefix(pattern, delimiter) && strings.HasSuffix(pattern, delimiter) +} + type ColumnFilter map[string]Filter func ParseTableFilter(only, except map[string][]string) Filter { diff --git a/test/files/mysql/schema.sql b/test/files/mysql/schema.sql index 15f41c31..234b91b7 100644 --- a/test/files/mysql/schema.sql +++ b/test/files/mysql/schema.sql @@ -181,7 +181,7 @@ create table type_monsters ( generated_nnull text GENERATED ALWAYS AS (UPPER(text_nnull)) STORED NOT NULL, generated_null text GENERATED ALWAYS AS (UPPER(text_null)) STORED, - INDEX(int_one, int_two) + UNIQUE(int_one, int_two) ); create view user_videos as @@ -216,4 +216,25 @@ CREATE INDEX idx2 ON test_index_expressions ((col1 + col2), col3); CREATE INDEX idx3 ON test_index_expressions (col1, (col2 + col3)); CREATE INDEX idx4 ON test_index_expressions (col3); CREATE INDEX idx5 ON test_index_expressions (col1 DESC, col2 DESC); -CREATE INDEX idx6 ON test_index_expressions ((POW(col3, 2))); \ No newline at end of file +CREATE INDEX idx6 ON test_index_expressions ((POW(col3, 2))); + +CREATE TABLE foo_bar ( + id INT AUTO_INCREMENT PRIMARY KEY, + secret_col VARCHAR(255) NOT NULL +); +CREATE TABLE foo_baz ( + id INT AUTO_INCREMENT PRIMARY KEY, + secret_col VARCHAR(255) NOT NULL +); +CREATE TABLE foo_qux ( + id INT AUTO_INCREMENT PRIMARY KEY, + secret_col VARCHAR(255) NOT NULL +); +CREATE TABLE bar_baz ( + id INT AUTO_INCREMENT PRIMARY KEY, + secret_col VARCHAR(255) NOT NULL +); +CREATE TABLE bar_qux ( + id INT AUTO_INCREMENT PRIMARY KEY, + secret_col VARCHAR(255) NOT NULL +); diff --git a/test/files/psql/schema.sql b/test/files/psql/schema.sql index a9100627..dea5aec5 100644 --- a/test/files/psql/schema.sql +++ b/test/files/psql/schema.sql @@ -285,3 +285,28 @@ CREATE INDEX idx3 ON test_index_expressions (col1, (col2 + col3)); CREATE INDEX idx4 ON test_index_expressions (col3); CREATE INDEX idx5 ON test_index_expressions (col1 DESC, col2 DESC); CREATE INDEX idx6 ON test_index_expressions (POW(col3, 2)); + +CREATE TABLE foo_bar ( + id SERIAL PRIMARY KEY, + secret_col VARCHAR(255) NOT NULL +); + +CREATE TABLE foo_baz ( + id SERIAL PRIMARY KEY, + secret_col VARCHAR(255) NOT NULL +); + +CREATE TABLE foo_qux ( + id SERIAL PRIMARY KEY, + secret_col VARCHAR(255) NOT NULL +); + +CREATE TABLE bar_baz ( + id SERIAL PRIMARY KEY, + secret_col VARCHAR(255) NOT NULL +); + +CREATE TABLE bar_qux ( + id SERIAL PRIMARY KEY, + secret_col VARCHAR(255) NOT NULL +); diff --git a/website/docs/code-generation/mysql.md b/website/docs/code-generation/mysql.md index 5c768de3..9034d85e 100644 --- a/website/docs/code-generation/mysql.md +++ b/website/docs/code-generation/mysql.md @@ -48,7 +48,31 @@ The values that exist for the drivers: | only | Only generate these | | | except | Skip generation for these | | -Example of Only/Except: +## Only/Except: + +The `only` and `except` configuration options can be used to specify which tables to include or exclude from code generation. You can either supply a list of table names or use regular expressions to match multiple tables. + +Consider the example below: + +```yaml +mysql: + only: + "/^foo/": + bar_baz: +``` + +This configuration only generates models for tables that start with `foo` and the table named `bar_baz`. + +Alternatively, the following example excludes these tables from code generation rather than including them: + +```yaml +mysql: + except: + "/^foo/": + bar_baz: +``` + +You may also exclude specific columns: ```yaml mysql: diff --git a/website/docs/code-generation/psql.md b/website/docs/code-generation/psql.md index cdf20923..1fc59da0 100644 --- a/website/docs/code-generation/psql.md +++ b/website/docs/code-generation/psql.md @@ -57,7 +57,31 @@ The values that exist for the drivers: | only | Only generate these | | | except | Skip generation for these | | -Example of Only/Except: +## Only/Except: + +The `only` and `except` configuration options can be used to specify which tables to include or exclude from code generation. You can either supply a list of table names or use regular expressions to match multiple tables. + +Consider the example below: + +```yaml +psql: + only: + "/^foo/": + bar_baz: +``` + +This configuration only generates models for tables that start with `foo` and the table named `bar_baz`. + +Alternatively, the following example excludes these tables from code generation rather than including them: + +```yaml +psql: + except: + "/^foo/": + bar_baz: +``` + +You may also exclude specific columns: ```yaml psql: