From 18e98b3320c1e00cd7e974d95eadad7a75cd6b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=85=89=E6=98=A5?= Date: Mon, 16 May 2022 23:23:31 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BC=98=E5=8C=96ip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- time_test.go | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 time_test.go diff --git a/time_test.go b/time_test.go deleted file mode 100644 index 306a08f..0000000 --- a/time_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package golog - -import ( - "encoding/json" - "go.dtapp.net/gotime" - "gorm.io/driver/postgres" - "gorm.io/gorm" - "testing" -) - -func TestTest(t *testing.T) { - dsn := "host=119.29.14.159 user=dbadmin password=98jolg256s.* dbname=logs port=15432 sslmode=disable TimeZone=Asia/Shanghai" - pgsqlDB, _ := gorm.Open(postgres.Open(dsn), &gorm.Config{}) - - client := NewClientApi(pgsqlDB, "test") - - // 插入时间 - client.Api.Record(ApiPostgresqlLog{ - RequestTime: TimeString{Time: gotime.Current().Time}, //【请求】时间 - ResponseTime: TimeString{Time: gotime.Current().Time}, //【返回】时间 - }) - - // 查询数据 - var result ApiPostgresqlLog - client.Api.Query().Where("log_id = ?", 10).Take(&result) - - t.Log(result) - t.Logf("result:%v", result) - t.Logf("result.request_time:%v", result.RequestTime) - t.Logf("result:%+v", result) - t.Logf("result.request_time:%+v", result.RequestTime) - - marshal, err := json.Marshal(result) - t.Logf("Marshal:%s", marshal) - t.Logf("Marshal:%v", marshal) - t.Logf("err:%v", err) - - var jsonM ApiPostgresqlLog - err = json.Unmarshal(marshal, &jsonM) - t.Logf("Unmarshal:%v", jsonM) - t.Logf("Unmarshal:%+v", jsonM) - t.Logf("err:%v", err) -}