Documentation
¶
Overview ¶
Package rules contains individual dialect rewrite rules used by the transpiler.
Index ¶
- func MySQLAutoIncrementToSerial(stmt ast.Statement) error
- func MySQLBacktickToDoubleQuote(_ ast.Statement) error
- func MySQLBooleanToPgBool(stmt ast.Statement) error
- func MySQLLimitCommaToOffset(_ ast.Statement) error
- func PgArrayToJSON(stmt ast.Statement) error
- func PgDoubleQuoteToBacktick(_ ast.Statement) error
- func PgILikeToLower(stmt ast.Statement) error
- func PgSerialToAutoIncrement(stmt ast.Statement) error
- func PgSerialToIntegerPK(stmt ast.Statement) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MySQLAutoIncrementToSerial ¶
MySQLAutoIncrementToSerial rewrites columns that use the AUTO_INCREMENT constraint to use the PostgreSQL SERIAL (or BIGSERIAL) type instead.
MySQL: id INT AUTO_INCREMENT PRIMARY KEY PostgreSQL: id SERIAL PRIMARY KEY
func MySQLBacktickToDoubleQuote ¶
MySQLBacktickToDoubleQuote is a no-op: the GoSQLX tokenizer strips backtick quoting and stores raw identifier names in the AST. The formatter applies the correct quoting style for the target dialect.
func MySQLBooleanToPgBool ¶
MySQLBooleanToPgBool rewrites TINYINT columns (MySQL's conventional boolean representation) to BOOLEAN for PostgreSQL.
Only TINYINT with no explicit size argument or TINYINT(1) is rewritten.
MySQL: active TINYINT(1) or active TINYINT PostgreSQL: active BOOLEAN
func MySQLLimitCommaToOffset ¶
MySQLLimitCommaToOffset is a no-op: the GoSQLX parser already normalises MySQL's `LIMIT offset, count` syntax into the AST's Limit / Offset fields, which are emitted by the formatter in standard `LIMIT n OFFSET m` form.
func PgArrayToJSON ¶
PgArrayToJSON rewrites PostgreSQL array types (e.g. TEXT[], INT[]) to TEXT. SQLite has no native array type; storing JSON-encoded arrays as TEXT is the conventional workaround.
PostgreSQL: tags TEXT[] SQLite: tags TEXT
func PgDoubleQuoteToBacktick ¶
PgDoubleQuoteToBacktick is a no-op: the GoSQLX AST stores raw (unquoted) identifier names. The formatter uses the target dialect's quoting style.
func PgILikeToLower ¶
PgILikeToLower rewrites PostgreSQL ILIKE to a LOWER() … LIKE LOWER() pair that is compatible with MySQL.
PostgreSQL: col ILIKE '%alice%' MySQL: LOWER(col) LIKE LOWER('%alice%')
func PgSerialToAutoIncrement ¶
PgSerialToAutoIncrement rewrites PostgreSQL SERIAL / BIGSERIAL / SMALLSERIAL column types to the MySQL equivalent (INT / BIGINT with AUTO_INCREMENT).
PostgreSQL: id SERIAL PRIMARY KEY MySQL: id INT AUTO_INCREMENT PRIMARY KEY
func PgSerialToIntegerPK ¶
PgSerialToIntegerPK rewrites PostgreSQL SERIAL/BIGSERIAL/SMALLSERIAL to INTEGER which, when paired with PRIMARY KEY, becomes SQLite's implicit auto-increment rowid alias.
PostgreSQL: id SERIAL PRIMARY KEY SQLite: id INTEGER PRIMARY KEY
Types ¶
This section is empty.