Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Mytable [][]SetupScript KeylessSetup [][]SetupScript VersionedSetup [][]SetupScript SpecialSetup [][]SetupScript SimpleSetup [][]SetupScript OrdinalSetup [][]SetupScript SpatialSetup [][]SetupScript JsonSetup [][]SetupScript FooSetup [][]SetupScript GraphSetup [][]SetupScript ReservedSetup [][]SetupScript ChecksSetup [][]SetupScript NullsSetup [][]SetupScript ComplexIndexSetup [][]SetupScript LoadDataSetup [][]SetupScript )
View Source
var AutoincrementData = []SetupScript{{
`drop table if exists auto_increment_tbl`,
"CREATE TABLE `auto_increment_tbl` ( `pk` bigint NOT NULL AUTO_INCREMENT, `c0` bigint, PRIMARY KEY (`pk`))",
`INSERT INTO auto_increment_tbl values (1, 11), (2, 22), (3, 33)`,
}}
View Source
var BigtableData = []SetupScript{{
`create table bigtable (t text primary key, n bigint)`,
`insert into bigtable values ('a', 1), ('s', 2), ('f', 3), ('g', 1), ('h', 2), ('j', 3), ('k', 1), ('l', 2), ('ñ', 4), ('z', 5), ('x', 6), ('c', 7), ('v', 8), ('b', 9)`,
}}
View Source
var Check_constraintData = []SetupScript{{
`CREATE TABLE checks (a INTEGER PRIMARY KEY, b INTEGER, c varchar(20))`,
`ALTER TABLE checks ADD CONSTRAINT chk1 CHECK (B > 0)`,
`ALTER TABLE checks ADD CONSTRAINT chk2 CHECK (b > 0) NOT ENFORCED`,
`ALTER TABLE checks ADD CONSTRAINT chk3 CHECK (B > 1)`,
`ALTER TABLE checks ADD CONSTRAINT chk4 CHECK (upper(C) = c)`,
}}
View Source
var Comp_index_tablesData = []SetupScript{{
`CREATE TABLE comp_index_t0 (pk BIGINT PRIMARY KEY, v1 BIGINT, v2 BIGINT)`,
`create INDEX v_idx on comp_index_t0 (v1, v2)`,
`INSERT INTO comp_index_t0 VALUES (0,0,48),(1,0,52),(2,2,4),(3,2,10),(4,3,35),(5,5,36),(6,5,60),(7,6,1),(8,6,51),(9,6,60),(10,6,73),(11,9,44),(12,9,97),(13,13,44),(14,14,53),(15,14,57),(16,14,98),(17,16,19),(18,16,53),(19,16,95),(20,18,31),(21,19,48),(22,19,75),(23,19,97),(24,24,60),(25,25,14),(26,25,31),(27,27,9),(28,27,24),(29,28,24),(30,28,83),(31,31,14),(32,33,39),(33,34,22),(34,34,91),(35,35,89),(36,38,20),(37,38,66),(38,39,55),(39,39,86),(40,40,97),(41,42,0),(42,42,82),(43,43,63),(44,44,48),(45,44,67),(46,45,22),(47,45,31),(48,45,63),(49,45,86),(50,46,46),(51,47,5),(52,48,22),(53,49,0),(54,50,0),(55,50,14),(56,51,35),(57,54,38),(58,56,0),(59,56,60),(60,57,29),(61,57,49),(62,58,12),(63,58,32),(64,59,29),(65,59,45),(66,59,54),(67,60,66),(68,61,3),(69,61,34),(70,63,19),(71,63,69),(72,65,80),(73,65,97),(74,67,95),(75,68,11),(76,69,34),(77,72,52),(78,74,81),(79,76,39),(80,78,0),(81,78,90),(82,79,36),(83,80,61),(84,80,88),(85,81,4),(86,82,16),(87,83,30),(88,83,74),(89,84,9),(90,84,45),(91,86,56),(92,86,88),(93,87,51),(94,89,3),(95,93,19),(96,93,21),(97,93,96),(98,98,0),(99,98,51),(100,98,61);`,
`CREATE TABLE comp_index_t1 (pk BIGINT PRIMARY KEY, v1 BIGINT, v2 BIGINT, v3 BIGINT)`,
`create INDEX v_idx on comp_index_t1 (v1, v2, v3)`,
`INSERT INTO comp_index_t1 VALUES (0,0,3,16),(1,2,65,9),(2,3,38,37),(3,3,99,99),(4,5,17,42),(5,6,6,76),(6,6,81,33),(7,7,33,51),(8,7,37,42),(9,8,9,21),(10,8,37,90),(11,9,39,20),(12,9,71,82),(13,10,16,21),(14,10,32,46),(15,10,47,36),(16,12,44,84),(17,12,66,40),(18,13,47,30),(19,13,56,41),(20,14,38,24),(21,14,91,1),(22,15,2,69),(23,16,40,36),(24,20,29,93),(25,21,9,89),(26,21,42,76),(27,23,13,53),(28,23,28,68),(29,23,28,90),(30,23,30,44),(31,24,20,8),(32,25,49,88),(33,26,15,28),(34,27,35,12),(35,28,39,84),(36,29,7,38),(37,29,21,74),(38,29,27,48),(39,29,77,46),(40,31,47,21),(41,31,47,91),(42,32,40,76),(43,33,70,50),(44,34,27,58),(45,35,32,36),(46,36,4,36),(47,36,84,75),(48,37,27,32),(49,38,88,68),(50,41,17,68),(51,41,77,26),(52,42,80,85),(53,45,1,57),(54,46,58,8),(55,49,26,11),(56,50,49,20),(57,50,86,6),(58,54,13,78),(59,54,57,83),(60,55,45,46),(61,55,81,80),(62,56,0,97),(63,56,8,78),(64,56,58,4),(65,56,66,33),(66,57,7,52),(67,59,77,53),(68,60,8,70),(69,61,11,25),(70,63,85,23),(71,65,17,9),(72,66,46,46),(73,66,73,4),(74,67,55,27),(75,70,8,54),(76,70,58,33),(77,71,39,15),(78,72,65,64),(79,74,78,26),(80,75,91,35),(81,76,40,52),(82,76,44,87),(83,81,32,4),(84,82,11,6),(85,82,46,32),(86,84,40,8),(87,84,93,37),(88,85,53,50),(89,86,63,79),(90,87,22,34),(91,87,57,62),(92,88,88,42),(93,90,30,67),(94,91,15,15),(95,93,7,26),(96,94,92,38),(97,95,89,66),(98,97,63,19),(99,98,31,21),(100,98,42,22)`,
`CREATE TABLE comp_index_t2 (pk BIGINT PRIMARY KEY, v1 BIGINT, v2 BIGINT, v3 BIGINT, v4 BIGINT)`,
`create INDEX v_idx on comp_index_t2 (v1, v2, v3, v4)`,
`INSERT INTO comp_index_t2 VALUES (0,0,33,2,67),(1,0,55,14,32),(2,1,43,13,36),(3,1,72,29,21),(4,2,27,1,75),(5,3,31,22,81),(6,4,6,67,80),(7,4,10,53,69),(8,4,27,77,5),(9,5,17,52,13),(10,5,32,30,48),(11,5,76,70,46),(12,7,7,66,62),(13,7,21,75,70),(14,7,76,26,47),(15,8,54,46,87),(16,8,99,43,1),(17,9,7,74,92),(18,9,19,38,35),(19,10,36,27,5),(20,12,0,33,62),(21,12,42,15,31),(22,12,46,43,23),(23,15,42,17,60),(24,17,49,14,7),(25,17,75,86,18),(26,20,30,34,71),(27,21,21,32,8),(28,22,21,28,78),(29,22,98,22,21),(30,23,43,13,11),(31,24,26,69,25),(32,24,45,96,0),(33,29,72,97,93),(34,32,16,97,29),(35,33,29,69,6),(36,33,53,56,88),(37,33,86,12,22),(38,34,55,37,34),(39,34,87,13,51),(40,34,89,27,90),(41,35,6,86,74),(42,36,7,40,16),(43,37,35,6,44),(44,37,41,36,10),(45,38,71,22,37),(46,39,45,75,55),(47,41,1,85,9),(48,41,21,82,54),(49,43,23,15,0),(50,43,66,85,66),(51,45,9,76,9),(52,47,94,56,21),(53,48,3,11,18),(54,50,26,23,71),(55,50,36,73,58),(56,50,39,26,37),(57,50,79,10,12),(58,50,97,0,79),(59,51,97,39,36),(60,52,72,44,2),(61,53,6,53,89),(62,53,48,19,36),(63,55,31,29,92),(64,57,25,97,65),(65,63,50,20,43),(66,64,23,33,5),(67,64,26,77,97),(68,64,41,74,85),(69,64,77,41,17),(70,66,97,6,39),(71,67,39,87,15),(72,69,81,70,37),(73,70,40,19,5),(74,70,56,21,22),(75,71,3,49,55),(76,71,48,89,99),(77,73,10,2,0),(78,73,91,56,0),(79,74,22,42,16),(80,74,35,72,97),(81,76,74,97,18),(82,82,29,66,71),(83,82,31,22,99),(84,82,70,5,47),(85,83,37,36,16),(86,83,41,53,57),(87,84,56,78,18),(88,85,2,3,88),(89,86,7,57,96),(90,87,23,16,63),(91,87,66,8,22),(92,88,57,12,88),(93,89,1,27,50),(94,89,91,7,45),(95,90,25,0,17),(96,91,23,2,9),(97,93,56,71,53),(98,94,43,71,43),(99,94,79,53,73),(100,96,73,38,38)`,
}}
View Source
var DatetimetableData = []SetupScript{{
"CREATE TABLE `datetime_table` ( `i` bigint NOT NULL, `date_col` date, `datetime_col` datetime, `timestamp_col` timestamp, `time_col` time(6), PRIMARY KEY (`i`))",
`insert into datetime_table values (1, '2019-12-31T12:00:00Z', '2020-01-01T12:00:00Z', '2020-01-02T12:00:00Z', '03:10:0'), (2, '2020-01-03T12:00:00Z', '2020-01-04T12:00:00Z', '2020-01-05T12:00:00Z', '04:00:44'), (3, '2020-01-07T00:00:00Z', '2020-01-07T12:00:00Z', '2020-01-07T12:00:01Z', '15:00:00.005000')`,
`create index datetime_table_d on datetime_table (date_col)`,
`create index datetime_table_dt on datetime_table (datetime_col)`,
`create index datetime_table_ts on datetime_table (timestamp_col)`,
}}
View Source
var EmptytableData = []SetupScript{{
`create table emptytable (i mediumint primary key, s text)`,
}}
View Source
var ExplodeData = []SetupScript{{
`create table explode (a bigint, b JSON, c text)`,
`insert into explode values (1, '["a", "b"]', 'first'), (2, '["c", "d"]', 'second'), (3, '["e", "f"]', 'third')`,
}}
View Source
var Fk_tblData = []SetupScript{{
"CREATE TABLE `fk_tbl` ( `pk` bigint NOT NULL, `a` bigint, `b` varchar(20), PRIMARY KEY (`pk`))",
`ALTER TABLE fk_tbl ADD CONSTRAINT fk1 FOREIGN KEY (a,b) REFERENCES mytable (i,s) ON DELETE CASCADE`,
}}
View Source
var FloattableData = []SetupScript{{
"CREATE TABLE `floattable` ( `i` bigint NOT NULL, `f32` float NOT NULL, `f64` double NOT NULL, PRIMARY KEY (`i`))",
`insert into floattable values (1, 1.0, 1.0), (2, 1.5, 1.5), (3, 2.0, 2.0), (4, 2.5, 2.5), (-1, -1.0, -1.0), (-2, -1.5, -1.5)`,
`create index floattable_f on floattable (f64)`,
}}
View Source
var FooData = []SetupScript{{
`create database if not exists foo`,
`create table foo.other_table (text text primary key, number mediumint)`,
`insert into foo.other_table values ('a', 4), ('b', 2), ('c', 0)`,
}}
View Source
var Graph_tablesData = []SetupScript{{
"CREATE TABLE `bus_routes` ( `origin` text NOT NULL, `dst` text NOT NULL, PRIMARY KEY (`origin`,`dst`))",
`insert into bus_routes values ('New York', 'Boston'), ('Boston', 'New York'), ('New York', 'Washington'), ('Washington', 'Boston'), ('Washington', 'Raleigh')`,
"CREATE TABLE `parts` ( `part` text NOT NULL, `sub_part` text NOT NULL, `quantity` bigint NOT NULL, PRIMARY KEY (`part`,`sub_part`))",
`insert into parts values ('pie', 'crust', 1), ('pie', 'filling', 2), ('crust', 'flour', 20), ('crust', 'sugar', 2), ('crust', 'butter', 15), ('crust', 'salt', 15), ('filling', 'sugar', 5), ('filling', 'fruit', 9), ('filling', 'salt', 3), ('filling', 'butter', 3)`,
}}
View Source
var Invert_pkData = []SetupScript{{
"CREATE TABLE `invert_pk` ( `x` bigint NOT NULL, `y` bigint NOT NULL, `z` bigint NOT NULL, PRIMARY KEY (`y`,`z`,`x`))",
`insert into invert_pk values (0, 2, 2), (1, 1, 0), (2, 0, 1)`,
}}
View Source
var JsontableData = []SetupScript{{
`create table jsontable (pk smallint primary key, c1 text, c2 JSON, c3 JSON)`,
`insert into jsontable values (1, 'row one', '[1,2]', '{"a": 2}'), (2, 'row two', '[3,4]', '{"b": 2}'), (3, 'row three', '[5,6]', '{"c": 2}'), (4, 'row four', '[7,8]', '{"d": 2}')`,
}}
View Source
var KeylessData = []SetupScript{{
"CREATE TABLE `unique_keyless` ( `c0` bigint, `c1` bigint)",
`insert into unique_keyless values (0,0), (1,1), (2,2)`,
"CREATE TABLE `keyless` ( `c0` bigint, `c1` bigint)",
`insert into keyless values (0,0), (1,1), (1,1), (2,2)`,
}}
View Source
var LoadtableData = []SetupScript{{
`create table loadtable(pk int primary key)`,
}}
View Source
var MydbData = []SetupScript{{
`create database if not exists mydb`,
`use mydb`,
}}
View Source
var MyhistorytableData = []SetupScript{{
"CREATE TABLE `myhistorytable` ( `i` bigint NOT NULL, `s` text NOT NULL, `c` text NOT NULL, PRIMARY KEY (`i`))",
}}
View Source
var MytableData = []SetupScript{{
`create table mytable (i bigint primary key, s varchar(20) comment 'column s' NOT NULL)`,
`insert into mytable values (1, 'first row'), (2, 'second row'), (3, 'third row')`,
`create unique index mytable_s on mytable (s)`,
`create index mytable_i_s on mytable (i,s)`,
"create index `idx_si` on mytable (`s`,`i`)",
}}
View Source
var Mytable_del_idxData = []SetupScript{{
`drop index mytable_s on mytable;`,
`drop index mytable_i_s on mytable;`,
`drop index idx_si on mytable;`,
}}
View Source
var NewlinetableData = []SetupScript{{
"CREATE TABLE `newlinetable` ( `i` bigint NOT NULL, `s` text NOT NULL, PRIMARY KEY (`i`))",
`insert into newlinetable values (1, '\nthere is some text in here'), (2, 'there is some\ntext in here'), (3, 'there is some text\nin here'), (4, 'there is some text in here\n'), (5, 'there is some text in here')`,
}}
View Source
var NiltableData = []SetupScript{{
"CREATE TABLE `niltable` ( `i` bigint NOT NULL, `i2` bigint, `b` tinyint, `f` double, PRIMARY KEY (`i`))",
`insert into niltable values (1,null,null,null), (2,2,1,null), (3,null,0,null), (4,4,null,4.0), (5,null,1,5.0), (6,6,0,6.0)`,
`create index niltable_i2 on niltable (i2)`,
}}
View Source
var Null_rangesData = []SetupScript{{
`create table null_ranges (x int primary key, y int)`,
`create index idx1 on null_ranges (y);`,
`insert into null_ranges values (0,0), (1,1), (2,2), (3,null), (4,null)`,
}}
View Source
var Ordinals_ddlData = []SetupScript{{
`CREATE TABLE short_ord_pk (x int not null, y int not null, primary key (y,x))`,
`CREATE TABLE long_ord_pk1 (u int, v int, w int, x int, y int, z int, PRIMARY KEY (y,v))`,
`CREATE TABLE long_ord_pk2 (u int, v int, w int, x int, y int, z int, PRIMARY KEY (y,v,x,z,u))`,
`CREATE TABLE long_ord_pk3 (u int, v int, w int, ww int, x int, y int, z int, PRIMARY KEY (y,v,x,z,u))`,
`CREATE TABLE ord_kl (u int, v int, w int, x int, y int, z int)`,
}}
View Source
var OthertableData = []SetupScript{{
`create table othertable (s2 text not null, i2 bigint primary key)`,
`insert into othertable values ('first', 3), ('second', 2), ('third', 1)`,
`create index othertable_s2 on othertable (s2)`,
`create index othertable_s2_i2 on othertable (s2,i2)`,
}}
View Source
var Othertable_del_idxData = []SetupScript{{
`drop index othertable_s2 on othertable;`,
`drop index othertable_s2_i2 on othertable;`,
}}
View Source
var Parent_childData = []SetupScript{{
`CREATE TABLE parent (id INT PRIMARY KEY, v1 INT, v2 INT)`,
`create index v1 on parent (v1)`,
`create index v2 on parent (v2)`,
`CREATE TABLE child (id INT PRIMARY KEY, v1 INT, v2 INT)`,
}}
View Source
var PeopleData = []SetupScript{{
"CREATE TABLE `people` ( `dob` date NOT NULL, `first_name` text NOT NULL, `last_name` text NOT NULL, `middle_name` text NOT NULL, `height_inches` bigint NOT NULL, `gender` bigint NOT NULL, PRIMARY KEY (`dob`,`first_name`,`last_name`,`middle_name`))",
`insert into people values ('1970-12-1', 'jon', 'smith', '', 72, 0), ('1980-1-11', 'jon', 'smith', '', 67, 0), ('1990-2-21', 'jane', 'doe', '', 68, 1), ('2000-12-31', 'frank', 'franklin', '', 70, 2), ('2010-3-15', 'jane', 'doe', '', 69, 1)`,
`create index people_l_f on people (last_name,first_name)`,
}}
View Source
var Pk_tablesData = []SetupScript{{
`create table one_pk (pk smallint primary key, c1 smallint, c2 smallint, c3 smallint, c4 smallint, c5 smallint)`,
`insert into one_pk values (0,0,1,2,3,4), (1,10,11,12,13,14), (2,20,21,22,23,24), (3,30,31,32,33,34)`,
`create table two_pk ( pk1 tinyint, pk2 tinyint, c1 tinyint NOT NULL, c2 tinyint NOT NULL, c3 tinyint NOT NULL, c4 tinyint NOT NULL, c5 tinyint NOT NULL, primary key (pk1, pk2))`,
`insert into two_pk values (0,0,0,1,2,3,4), (0,1,10,11,12,13,14), (1,0,20,21,22,23,24), (1,1,30,31,32,33,34)`,
`create table one_pk_two_idx ( pk bigint primary key, v1 bigint, v2 bigint)`,
`insert into one_pk_two_idx values (0,0,0), (1,1,1), (2,2,2), (3,3,3), (4,4,4), (5,5,5), (6,6,6), (7,7,7)`,
`create table one_pk_three_idx ( pk bigint primary key, v1 bigint, v2 bigint, v3 bigint)`,
`insert into one_pk_three_idx values (0,0,0,0), (1,0,0,1), (2,0,1,0), (3,0,2,2), (4,1,0,0), (5,2,0,3), (6,3,3,0), (7,4,4,4)`,
`create index one_pk_two_idx_1 on one_pk_two_idx (v1)`,
`create index one_pk_two_idx_2 on one_pk_two_idx (v1, v2)`,
`create index one_pk_three_idx_idx on one_pk_three_idx (v1, v2, v3)`,
}}
View Source
var Reserved_keywordsData = []SetupScript{{
"CREATE TABLE `reservedWordsTable` ( `Timestamp` text NOT NULL, `and` text, `or` text, `select` text, PRIMARY KEY (`Timestamp`))",
`insert into reservedWordsTable values ('1', '1.1', 'aaa', 'create')`,
}}
View Source
var SpatialData = []SetupScript{{
`create table stringtogeojson_table (i bigint primary key, s blob)`,
`insert into stringtogeojson_table values (0, '{"type": "Point", "coordinates": [1,2]}'), (1, '{"type": "Point", "coordinates": [123.45,56.789]}'), (2, '{"type": "LineString", "coordinates": [[1,2],[3,4]]}'), (3, '{"type": "LineString", "coordinates": [[1.23,2.345],[3.56789,4.56]]}'), (4, '{"type": "Polygon", "coordinates": [[[1.1,2.2],[3.3,4.4],[5.5,6.6],[1.1,2.2]]]}'), (5, '{"type": "Polygon", "coordinates": [[[0,0],[1,1],[2,2],[0,0]]]}')`,
`create table geometry_table (i bigint primary key, g geometry NOT NULL)`,
`insert into geometry_table values (1, ST_GeomFromText('Point(1 2)')), (2, ST_GeomFromText('Linestring(1 2,3 4)')), (3, ST_GeomFromText('POLYGON((0 0,0 1,1 1,0 0))')), (4, ST_SRID(ST_GeomFromText('Point(1 2)'), 4326)), (5, ST_SRID(ST_GeomFromText('Linestring(1 2,3 4)'), 4326)), (6, ST_SRID(ST_GeomFromText('POLYGON((0 0,0 1,1 1,0 0))'), 4326))`,
`create table point_table (i bigint primary key, p point NOT NULL);`,
`insert into point_table values (5, ST_GeomFromText('Point(1 2)'))`,
`create table line_table (i bigint primary key, l linestring NOT NULL);`,
`insert into line_table values (0, ST_GeomFromText('Linestring(1 2,3 4)')), (1, ST_GeomFromText('Linestring(1 2,3 4,5 6)'))`,
`create table polygon_table (i bigint primary key, p polygon NOT NULL);`,
`insert into polygon_table values (0, ST_GeomFromText('Polygon((0 0,0 1,1 1,0 0))'))`,
}}
View Source
var SpecialtableData = []SetupScript{{
`create table specialtable (id bigint primary key, name varchar(20))`,
`insert into specialtable values (1, 'first_row'), (2, 'second_row'), (3, 'third_row'), (4, '%'), (5, '\''), (6, '\"'), (7, '\t'), (8, '\n'), (9, "\v"), (10, 'test%test'), (11, 'test\'test'), (12, 'test\"test'), (13, 'test\ttest'), (14, 'test\ntest'), (15, 'test\vtest')`,
}}
View Source
var StringandtableData = []SetupScript{{
"CREATE TABLE `stringandtable` ( `k` bigint NOT NULL, `i` bigint, `v` text, PRIMARY KEY (`k`));",
`insert into stringandtable values (0, 0, '0'), (1, 1, '1'), (2, 2, ''), (3, 3, 'true'), (4, 4, 'false'), (5, 5, null), (6, null, '2');`,
}}
View Source
var TabletestData = []SetupScript{{
`create table tabletest ( i int primary key, s text not null)`,
`insert into tabletest values (1, 'first row'), (2, 'second row'), (3, 'third row')`,
}}
View Source
var TestdbData = []SetupScript{{
`create database test;`,
}}
View Source
var TypestableData = []SetupScript{{
"CREATE TABLE `typestable` ( `id` bigint NOT NULL, `i8` tinyint, `i16` smallint, `i32` int, `i64` bigint, `u8` tinyint unsigned, `u16` smallint unsigned, `u32` int unsigned, `u64` bigint unsigned, `f32` float, `f64` double, `ti` timestamp, `da` date, `te` text, `bo` tinyint, `js` json, `bl` blob, PRIMARY KEY (`id`))",
`insert into typestable values (1,2,3,4,5,6,7,8,9,10.0,11.0,'2019-12-31T12:00:00Z','2019-12-31T00:00:00Z','fourteen', 0,null,null)`,
}}
View Source
var ViewsData = []SetupScript{{
`CREATE VIEW myview1 AS SELECT * FROM myhistorytable`,
`CREATE VIEW myview2 AS SELECT * FROM myview WHERE i = 1`,
}}
Functions ¶
func NewFileSetup ¶
func NewStringSetup ¶
func NewStringSetup(s ...string) []setupSource
Types ¶
type SetupScript ¶
type SetupScript []string
Click to show internal directories.
Click to hide internal directories.