test_sql.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package dpsapi
  2. import (
  3. uuid "github.com/satori/go.uuid"
  4. "strings"
  5. )
  6. const (
  7. 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)`
  8. parseSqlDelete = `delete from students where id = 'aaa' AND name = 'yjp' AND age < 100 AND describe IN ('yjp')`
  9. )
  10. const (
  11. sqlInsertFormat = `insert into %s (id, name, time, table_num) values ('%s', '%s', parse_time('%s', '2006-01-02 15:04:05'), %d)`
  12. )
  13. const (
  14. dpsAddress = "localhost:30170"
  15. testDatabaseID = "ee2d7dabe56646ce835d80873348ee0e"
  16. )
  17. var tableModelDescribe = map[string]string{
  18. "ID": "gorm:\"primary_key;type:varchar(32);comment:id;\"",
  19. "Name": "gorm:\"not null;type:varchar(128);comment:数据库名称;\"",
  20. "Time": "gorm:\"not null;type:timestamp with time zone;comment:数据库时间;\"",
  21. "TableNum": "gorm:\"not null;type:integer;comment:数据库表数量;\"",
  22. }
  23. func getUUID() string {
  24. return uuid.NewV4().String()
  25. }
  26. func simpleUUID() string {
  27. return strings.ReplaceAll(getUUID(), "-", "")
  28. }