Skip to content

mysql: Add datatype tests #1948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions internal/endtoend/testdata/datatype/mysql/go/db.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 91 additions & 0 deletions internal/endtoend/testdata/datatype/mysql/go/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions internal/endtoend/testdata/datatype/mysql/sql/character.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-- Character Types
-- https://dev.mysql.com/doc/refman/8.0/en/string-type-syntax.html
CREATE TABLE dt_character (
a CHARACTER(32),
b VARCHAR(32),
c CHAR(32),
d BINARY(32),
e VARBINARY(32),
f TINYBLOB,
g TINYTEXT,
h TEXT,
i MEDIUMTEXT,
j MEDIUMBLOB,
k LONGTEXT,
l LONGBLOB
);

CREATE TABLE dt_character_not_null (
a CHARACTER(32) NOT NULL,
b VARCHAR(32) NOT NULL,
c CHAR(32) NOT NULL,
d BINARY(32) NOT NULL,
e VARBINARY(32) NOT NULL,
f TINYBLOB NOT NULL,
g TINYTEXT NOT NULL,
h TEXT NOT NULL,
i MEDIUMTEXT NOT NULL,
j MEDIUMBLOB NOT NULL,
k LONGTEXT NOT NULL,
l LONGBLOB NOT NULL
);
13 changes: 13 additions & 0 deletions internal/endtoend/testdata/datatype/mysql/sql/datetime.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- Date/Time Types
-- https://www.sqlite.org/datatype3.html
CREATE TABLE dt_datetime (
a DATE,
b DATETIME,
c TIMESTAMP
);

CREATE TABLE dt_datetime_not_null (
a DATE NOT NULL,
b DATETIME NOT NULL,
c TIMESTAMP NOT NULL
);
40 changes: 40 additions & 0 deletions internal/endtoend/testdata/datatype/mysql/sql/numeric.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
-- Numeric Types
-- https://dev.mysql.com/doc/refman/8.0/en/numeric-type-syntax.html
CREATE TABLE dt_numeric (
a INT,
b INTEGER,
c TINYINT,
d SMALLINT,
e MEDIUMINT,
f BIGINT,
g BIT,
h DECIMAL(10, 5),
i DEC(10, 5),
j FLOAT,
k DOUBLE,
l DOUBLE PRECISION
);

CREATE TABLE dt_numeric_unsigned (
a INT UNSIGNED,
b INTEGER UNSIGNED,
c TINYINT UNSIGNED,
d SMALLINT UNSIGNED,
e MEDIUMINT UNSIGNED,
f BIGINT UNSIGNED
);

CREATE TABLE dt_numeric_not_null (
a INT NOT NULL,
b INTEGER NOT NULL,
c TINYINT NOT NULL,
d SMALLINT NOT NULL,
e MEDIUMINT NOT NULL,
f BIGINT NOT NULL,
g BIT NOT NULL,
h DECIMAL(10, 5) NOT NULL,
i DEC(10, 5) NOT NULL,
j FLOAT NOT NULL,
k DOUBLE NOT NULL,
l DOUBLE PRECISION NOT NULL
);
1 change: 1 addition & 0 deletions internal/endtoend/testdata/datatype/mysql/sql/query.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SELECT 1;
12 changes: 12 additions & 0 deletions internal/endtoend/testdata/datatype/mysql/sqlc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "1",
"packages": [
{
"path": "go",
"engine": "mysql",
"name": "datatype",
"schema": "sql/",
"queries": "sql/"
}
]
}