diff --git a/examples/api/openapi.yaml b/examples/api/openapi.yaml new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/api/openapi.yaml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/api_test/client_test.go b/examples/api_test/client_test.go new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/api_test/client_test.go @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/backup/insert_data.sql b/examples/backup/insert_data.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/backup/insert_data.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/backup/schema.sql b/examples/backup/schema.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/backup/schema.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/benchmark/schema.sql b/examples/benchmark/schema.sql new file mode 100644 index 00000000000..5a86e01f041 --- /dev/null +++ b/examples/benchmark/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE benchmark_table ( + id bigint NOT NULL, + - data varbinary(128), + + data varchar(128), + PRIMARY KEY (id) +); \ No newline at end of file diff --git a/examples/ci/test_config.yaml b/examples/ci/test_config.yaml new file mode 100644 index 00000000000..1f050a5d262 --- /dev/null +++ b/examples/ci/test_config.yaml @@ -0,0 +1,7 @@ +test_cases: + - name: "user_insertion" + - query: "INSERT INTO users (email) VALUES (_binary ?)" + + query: "INSERT INTO users (email) VALUES (?)" + params: + - - "test@example.com" + + "test@example.com" \ No newline at end of file diff --git a/examples/client/main.go b/examples/client/main.go new file mode 100644 index 00000000000..af47e02c959 --- /dev/null +++ b/examples/client/main.go @@ -0,0 +1,40 @@ +package main + +import ( + "database/sql" + "fmt" + + _ "github.com/go-sql-driver/mysql" +) + +func insertExample(conn *sql.DB) error { + stmt, err := conn.Prepare("INSERT INTO users (name) VALUES (?)") + if err != nil { + return err + } + defer stmt.Close() + + _, err = stmt.Exec("test@example.com") + if err != nil { + return err + } + + return nil +} + +func main() { + db, err := sql.Open("mysql", "user:password@tcp(127.0.0.1:3306)/database") + if err != nil { + fmt.Println("Error connecting to database:", err) + return + } + defer db.Close() + + err = insertExample(db) + if err != nil { + fmt.Println("Error inserting example:", err) + return + } + + fmt.Println("Example inserted successfully") +} \ No newline at end of file diff --git a/examples/commerce/product_data.sql b/examples/commerce/product_data.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/commerce/product_data.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/commerce/product_schema.sql b/examples/commerce/product_schema.sql new file mode 100644 index 00000000000..312a7e17c99 --- /dev/null +++ b/examples/commerce/product_schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE product ( + sku varbinary(128) NOT NULL, + description varchar(128), + // ... other columns ... + PRIMARY KEY (sku) +); \ No newline at end of file diff --git a/examples/commerce/vschema.json b/examples/commerce/vschema.json new file mode 100644 index 00000000000..3a9caffcc20 --- /dev/null +++ b/examples/commerce/vschema.json @@ -0,0 +1,18 @@ +{ + "sharded": true, + "vindexes": { + "product_index": { + "type": "xxhash" + } + }, + "tables": { + "product": { + "column_vindexes": [ + { + "column": "sku", + "name": "product_index" + } + ] + } + } +} \ No newline at end of file diff --git a/examples/compose/backup/backup_test.sql b/examples/compose/backup/backup_test.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/compose/backup/backup_test.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/compose/external_db/mysql/init.sql b/examples/compose/external_db/mysql/init.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/compose/external_db/mysql/init.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/compose/init_test_data.sql b/examples/compose/init_test_data.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/compose/init_test_data.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/compose/lookup_keyspace_schema_file.sql b/examples/compose/lookup_keyspace_schema_file.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/compose/lookup_keyspace_schema_file.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/compose/mysql/conf.d/charset.cnf b/examples/compose/mysql/conf.d/charset.cnf new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/compose/mysql/conf.d/charset.cnf @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/compose/performance/perf_schema.sql b/examples/compose/performance/perf_schema.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/compose/performance/perf_schema.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/compose/sharding/resharding_test.sql b/examples/compose/sharding/resharding_test.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/compose/sharding/resharding_test.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/compose/test_keyspace_schema_file.sql b/examples/compose/test_keyspace_schema_file.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/compose/test_keyspace_schema_file.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/compose/vtcompose/test_schema.sql b/examples/compose/vtcompose/test_schema.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/compose/vtcompose/test_schema.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/connection/pool_test.go b/examples/connection/pool_test.go new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/connection/pool_test.go @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/customer/customer_schema.sql b/examples/customer/customer_schema.sql new file mode 100644 index 00000000000..0cc27d6b51f --- /dev/null +++ b/examples/customer/customer_schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE customer ( + customer_id bigint NOT NULL, + email varchar(128), + name varchar(128), + // ... other columns ... +); \ No newline at end of file diff --git a/examples/customer/vschema.json b/examples/customer/vschema.json new file mode 100644 index 00000000000..29b398c69eb --- /dev/null +++ b/examples/customer/vschema.json @@ -0,0 +1,18 @@ +{ + "sharded": true, + "vindexes": { + "hash": { + "type": "xxhash" + } + }, + "tables": { + "customer": { + "column_vindexes": [ + { + "column": "email", + "name": "hash" + } + ] + } + } +} \ No newline at end of file diff --git a/examples/demo/init_data.sql b/examples/demo/init_data.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/demo/init_data.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/demo/user_schema.sql b/examples/demo/user_schema.sql new file mode 100644 index 00000000000..3a114b17b8b --- /dev/null +++ b/examples/demo/user_schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE user ( + user_id bigint NOT NULL, + name varchar(128), + email varchar(128), + PRIMARY KEY (user_id) +); \ No newline at end of file diff --git a/examples/demo/vschema.json b/examples/demo/vschema.json new file mode 100644 index 00000000000..02e67a65048 --- /dev/null +++ b/examples/demo/vschema.json @@ -0,0 +1,18 @@ +{ + "sharded": true, + "vindexes": { + "name_index": { + "type": "xxhash" + } + }, + "tables": { + "product": { + "column_vindexes": [ + { + "column": "sku", + "name": "product_index" + } + ] + } + } +} \ No newline at end of file diff --git a/examples/e2e/main_test.go b/examples/e2e/main_test.go new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/e2e/main_test.go @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/integration/setup.sql b/examples/integration/setup.sql new file mode 100644 index 00000000000..d04c62403ec --- /dev/null +++ b/examples/integration/setup.sql @@ -0,0 +1,12 @@ +CREATE TABLE integration_test ( + test_id bigint NOT NULL, + - test_data varbinary(128), + + test_data varchar(128), + PRIMARY KEY (test_id) +); + +INSERT INTO integration_test VALUES + - (1, _binary 'test_value_1'), + + (1, 'test_value_1'), + - (2, _binary 'test_value_2'), + + (2, 'test_value_2'); \ No newline at end of file diff --git a/examples/kubernetes/config.yaml b/examples/kubernetes/config.yaml new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/kubernetes/config.yaml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/local_example/main_test.go b/examples/local_example/main_test.go new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/local_example/main_test.go @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/local_example/user_table.sql b/examples/local_example/user_table.sql new file mode 100644 index 00000000000..5d9dcdc96ce --- /dev/null +++ b/examples/local_example/user_table.sql @@ -0,0 +1,8 @@ +CREATE TABLE user ( + user_id bigint, + - name varbinary(128), + + name varchar(128), + - email varbinary(128), + + email varchar(128), + PRIMARY KEY (user_id) +); \ No newline at end of file diff --git a/examples/migration/schema_test.sql b/examples/migration/schema_test.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/migration/schema_test.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/migration_tools/schema.sql b/examples/migration_tools/schema.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/migration_tools/schema.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/online_migration/schema.sql b/examples/online_migration/schema.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/online_migration/schema.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/operator/customer.sql b/examples/operator/customer.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/operator/customer.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/operator/init_db.sql b/examples/operator/init_db.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/operator/init_db.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/operator/vschema.json b/examples/operator/vschema.json new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/operator/vschema.json @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/performance/load_data.sql b/examples/performance/load_data.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/performance/load_data.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/recovery/backup_test.sql b/examples/recovery/backup_test.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/recovery/backup_test.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/region_sharding/main_test.go b/examples/region_sharding/main_test.go new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/region_sharding/main_test.go @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/region_sharding/user_table.sql b/examples/region_sharding/user_table.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/region_sharding/user_table.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/reshard/insert_customer.sql b/examples/reshard/insert_customer.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/reshard/insert_customer.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/reshard/schema.sql b/examples/reshard/schema.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/reshard/schema.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/reshard/vschema.json b/examples/reshard/vschema.json new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/reshard/vschema.json @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/testing/data_generator.go b/examples/testing/data_generator.go new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/testing/data_generator.go @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/unsharded/user_table.sql b/examples/unsharded/user_table.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/unsharded/user_table.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/vtgate/insert_data.sql b/examples/vtgate/insert_data.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/vtgate/insert_data.sql @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/vtgate/schema.sql b/examples/vtgate/schema.sql new file mode 100644 index 00000000000..0519ecba6ea --- /dev/null +++ b/examples/vtgate/schema.sql @@ -0,0 +1 @@ + \ No newline at end of file