update
continuous-integration/drone/push Build is failing Details

master v1.0.1
李光春 2 years ago
parent fdb5bc54bd
commit ce96abecb0

@ -0,0 +1,36 @@
package golog
import "gorm.io/gorm"
type App struct {
Gin gin // 框架日志
Api api // 接口日志
Pgsql *gorm.DB // pgsql数据库
TableName string // 日志表名
}
// InitClientApi 接口实例化
func (a *App) InitClientApi() {
if a.Pgsql == nil {
panic("驱动不正常")
}
if a.TableName == "" {
panic("表名不能为空")
}
a.Api.db = a.Pgsql
a.Api.tableName = a.TableName
a.Api.AutoMigrate()
}
// InitClientGin 框架实例化
func (a *App) InitClientGin() {
if a.Pgsql == nil {
panic("驱动不正常")
}
if a.TableName == "" {
panic("表名不能为空")
}
a.Gin.db = a.Pgsql
a.Gin.tableName = a.TableName
a.Gin.AutoMigrate()
}

@ -0,0 +1,9 @@
package golog
import "testing"
var a = App{}
func TestApp(t *testing.T) {
a.Pgsql = nil
}

@ -2,8 +2,6 @@ package golog
import "gorm.io/gorm"
const Version = "1.0.0"
type Client struct {
Gin gin // 框架日志
Api api // 接口日志

@ -0,0 +1,10 @@
package golog
import "testing"
var c = &Client{}
func TestClient(t *testing.T) {
c = NewClientGin(nil, "")
c = NewClientApi(nil, "")
}

@ -0,0 +1,3 @@
package golog
const Version = "1.0.1"
Loading…
Cancel
Save