2022-05-16 11:49:05 +08:00
|
|
|
// Package mysql ...
|
|
|
|
//
|
|
|
|
// Description : mysql ...
|
|
|
|
//
|
|
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
|
|
//
|
|
|
|
// Date : 2022-05-16 11:23
|
|
|
|
package mysql
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
2022-05-16 14:06:41 +08:00
|
|
|
|
|
|
|
"git.zhangdeman.cn/zhangdeman/mysql/sql2go"
|
2022-05-16 11:49:05 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
testDBClient *DBClient
|
|
|
|
)
|
|
|
|
|
|
|
|
// getClient 获取数据库连接
|
|
|
|
//
|
|
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
|
|
//
|
|
|
|
// Date : 11:24 2022/5/16
|
|
|
|
func init() {
|
|
|
|
cfg := &DBConfig{
|
2022-06-05 19:07:25 +08:00
|
|
|
Host: "localhost",
|
|
|
|
Port: 3306,
|
|
|
|
Database: "gateway",
|
|
|
|
Username: "root",
|
|
|
|
Password: "zhangdeman",
|
|
|
|
Charset: "utf8mb4",
|
|
|
|
Connection: Connection{
|
|
|
|
MaxOpen: 100,
|
|
|
|
MaxIdle: 100,
|
|
|
|
},
|
2022-05-16 11:49:05 +08:00
|
|
|
}
|
|
|
|
testDBClient, _ = NewDBClient(cfg, cfg, nil, nil, nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
// TestGetCreateTableSQL 测试简表sql
|
|
|
|
//
|
|
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
|
|
//
|
|
|
|
// Date : 11:24 2022/5/16
|
|
|
|
func TestGetCreateTableSQL(t *testing.T) {
|
|
|
|
sys := &SystemDao{}
|
2022-05-16 14:06:41 +08:00
|
|
|
sql, _ := sys.GetCreateTableSQL(testDBClient.GetMaster(nil), "app")
|
|
|
|
fmt.Println(sql2go.GenerateDao(sql, "aaa"))
|
2022-05-16 11:49:05 +08:00
|
|
|
}
|