test_sql.go 986 B

12345678910111213141516171819202122232425262728293031323334
  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. )
  9. const (
  10. sqlInsertFormat = `insert into %s (id, name, time, table_num) values ('%s', '%s', parse_time('%s', '2006-01-02 15:04:05'), %d)`
  11. )
  12. const (
  13. dpsAddress = "localhost:30170"
  14. testDatabaseID = "ee2d7dabe56646ce835d80873348ee0e"
  15. )
  16. var tableModelDescribe = map[string]string{
  17. "ID": "gorm:\"primary_key;type:varchar(32);comment:id;\"",
  18. "Name": "gorm:\"not null;type:varchar(128);comment:数据库名称;\"",
  19. "Time": "gorm:\"not null;type:timestamp with time zone;comment:数据库时间;\"",
  20. "TableNum": "gorm:\"not null;type:integer;comment:数据库表数量;\"",
  21. }
  22. func getUUID() string {
  23. return uuid.NewV4().String()
  24. }
  25. func simpleUUID() string {
  26. return strings.ReplaceAll(getUUID(), "-", "")
  27. }