package test import ( uuid "github.com/satori/go.uuid" "strings" ) const ( parseSqlInsert = `insert into students (id, name, age, rate, time, is_right) values ('aaa', 'yjp', 5, 92.5, parse_time('2024-01-01 00:00:00', '2006-01-02 15:04:05'), false)` parseSqlDelete = `delete from students where id = 'aaa' AND name = 'yjp' AND age < 100 AND describe IN ('yjp')` parseSqlUpdate = `update students set name = 'yjp', age = 5, age = 5, rate = 92.5, time = parse_time('2024-01-01 00:00:00', '2006-01-02 15:04:05'), is_right = false where id = 'aaa' AND name = 'yjp' AND age < 100 AND describe IN ('yjp')` parseSqlSelectWithJoin = `select id, name, age from students left join classes on students.id = classes.student_id left join identities on students.id = identities.student_id where students.id = 'aaa' order by students.name desc limit 20 offset 2` parseSqlSelectWithSubQuery = `select * from (select * from class where id = 'bbb') where students.id = 'aaa' and students.age = 3` parseSqlSelectWithGroupBy = `select count(*) from students group by name, age having name = 'aaa' and age = 5` ) const ( sqlInsertFormat = `insert into %s (id, name, time, table_num) values ('%s', '%s', parse_time('%s', '2006-01-02 15:04:05'), %d)` sqlDeleteFormat = `delete from %s where id = '%s'` sqlUpdateFormat = `update %s set name = '%s', time = parse_time('%s', '2006-01-02 15:04:05'), table_num = %d where id = '%s'` sqlSelectFormat = `select * from %s where id = '%s'` sqlCountFormat = `select count(*) as count from %s where id = '%s'` ) const ( dpsAddress = "localhost:30170" testDatabaseID = "ee2d7dabe56646ce835d80873348ee0e" ) var tableModelDescribe = map[string]string{ "ID": "gorm:\"primary_key;type:varchar(32);comment:id;\"", "Name": "gorm:\"not null;type:varchar(128);comment:数据库名称;\"", "Time": "gorm:\"not null;type:timestamp with time zone;comment:数据库时间;\"", "TableNum": "gorm:\"not null;type:integer;comment:数据库表数量;\"", } func getUUID() string { return uuid.NewV4().String() } func simpleUUID() string { return strings.ReplaceAll(getUUID(), "-", "") }