diff --git a/go.mod b/go.mod index 9b9b809..7a61e3e 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.14 require ( github.com/google/uuid v1.1.2 // indirect github.com/magiconair/properties v1.8.2 // indirect - github.com/stretchr/testify v1.6.1 + github.com/stretchr/testify v1.7.0 github.com/team4yf/fpm-go-pkg v0.0.0-20200909075814-040cb22d0a7d github.com/team4yf/yf-fpm-server-go v0.2.4 go.uber.org/zap v1.16.0 // indirect diff --git a/go.sum b/go.sum index 987f4ef..681b185 100644 --- a/go.sum +++ b/go.sum @@ -294,6 +294,8 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/team4yf/fpm-go-pkg v0.0.0-20200907232930-67704d580ed7 h1:Aj3aR0AJbtGMaaFopjtSD6etjFDDfOQKpa6kgI2Mg+g= @@ -494,6 +496,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/postgres v1.0.0 h1:Yh4jyFQ0a7F+JPU0Gtiam/eKmpT/XFc1FKxotGqc6FM= gorm.io/driver/postgres v1.0.0/go.mod h1:wtMFcOzmuA5QigNsgEIb7O5lhvH1tHAF1RbWmLWV4to= diff --git a/plugins/dbImpl.go b/plugins/dbImpl.go index bc0d072..1e1daa5 100644 --- a/plugins/dbImpl.go +++ b/plugins/dbImpl.go @@ -322,6 +322,9 @@ func (p *ormImpl) Create(q *db.BaseData, entity interface{}) error { keys := make([]string, 0) vals := make([]string, 0) for k, v := range e { + if k == "updateAt" || k == "createAt" || k == "createat" || k == "updateat" { + continue + } keys = append(keys, "\""+k+"\"") switch v.(type) { case string: diff --git a/test/pg_test.go b/test/pg_test.go index 639a17b..7eb860e 100644 --- a/test/pg_test.go +++ b/test/pg_test.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "testing" + "time" "github.com/stretchr/testify/assert" "github.com/team4yf/yf-fpm-server-go/fpm" @@ -252,8 +253,9 @@ func TestUpdateBiz(t *testing.T) { "condition": "name = 'ff'", "id": 112, "row": map[string]interface{}{ - "name": "ff", - "value": 103, + "name": "ff", + "createAt": time.Now().Unix(), + "value": 103, }, }) diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 4e8b101..0000000 --- a/test/test.js +++ /dev/null @@ -1,22 +0,0 @@ -const { fpmc, DBQuery } = require('fpmc-jssdk'); -const { DBObject } = require('fpmc-jssdk/lib/bo/impl/DBObject'); -fpmc.init({ appkey: '123123', masterKey: '123123', endpoint: 'http://localhost:9090/api', v: '0.0.1' }); - -(async ()=>{ - try { - // const query = new DBQuery('fake') - // const data = await query.select('NAME').condition(`name = 'ff'`).page(1,10).sort('name-').first() - // console.log(data) - const obj = new DBObject('fake', {id: 110}) - // const rsp = await obj.save({ - // name: 'c' - // }) - - // console.log(rsp) - console.log(await obj.remove(112)) - - } catch (error) { - console.error(error) - } - -})() \ No newline at end of file