yjp 1 жил өмнө
parent
commit
dae858cfe7
6 өөрчлөгдсөн 674 нэмэгдсэн , 5 устгасан
  1. 28 2
      go.mod
  2. 86 3
      go.sum
  3. 79 0
      instance.go
  4. 152 0
      instance_command.go
  5. 238 0
      instance_event_query.go
  6. 91 0
      instance_query.go

+ 28 - 2
go.mod

@@ -3,21 +3,47 @@ module git.sxidc.com/service-supports/dps-sdk
 go 1.21.3
 
 require (
+	git.sxidc.com/service-supports/fslog v0.5.9
 	github.com/golang/protobuf v1.5.3
 	github.com/mwitkow/go-proto-validators v0.3.2
 	github.com/satori/go.uuid v1.2.0
-	github.com/stretchr/testify v1.3.0
+	github.com/stretchr/testify v1.8.4
 	google.golang.org/grpc v1.60.1
 	google.golang.org/protobuf v1.32.0
 )
 
 require (
-	github.com/davecgh/go-spew v1.1.0 // indirect
+	github.com/bytedance/sonic v1.10.0 // indirect
+	github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
+	github.com/chenzhuoyu/iasm v0.9.0 // indirect
+	github.com/davecgh/go-spew v1.1.1 // indirect
+	github.com/gabriel-vasile/mimetype v1.4.2 // indirect
+	github.com/gin-contrib/sse v0.1.0 // indirect
+	github.com/gin-gonic/gin v1.9.1 // indirect
+	github.com/go-playground/locales v0.14.1 // indirect
+	github.com/go-playground/universal-translator v0.18.1 // indirect
+	github.com/go-playground/validator/v10 v10.15.3 // indirect
+	github.com/goccy/go-json v0.10.2 // indirect
 	github.com/gogo/protobuf v1.3.0 // indirect
+	github.com/json-iterator/go v1.1.12 // indirect
+	github.com/klauspost/cpuid/v2 v2.2.5 // indirect
+	github.com/leodido/go-urn v1.2.4 // indirect
+	github.com/mattn/go-isatty v0.0.19 // indirect
+	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
+	github.com/modern-go/reflect2 v1.0.2 // indirect
+	github.com/pelletier/go-toml/v2 v2.1.0 // indirect
 	github.com/pmezard/go-difflib v1.0.0 // indirect
+	github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
+	github.com/ugorji/go/codec v1.2.11 // indirect
+	go.uber.org/multierr v1.11.0 // indirect
+	go.uber.org/zap v1.25.0 // indirect
+	golang.org/x/arch v0.5.0 // indirect
+	golang.org/x/crypto v0.14.0 // indirect
 	golang.org/x/net v0.16.0 // indirect
 	golang.org/x/sys v0.13.0 // indirect
 	golang.org/x/text v0.13.0 // indirect
 	google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect
 	gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
+	gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
+	gopkg.in/yaml.v3 v3.0.1 // indirect
 )

+ 86 - 3
go.sum

@@ -1,5 +1,36 @@
-github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
+git.sxidc.com/service-supports/fslog v0.5.9 h1:q2XIK2o/fk/qmByy4x5kKLC+k7kolT5LrXHcWRSffXQ=
+git.sxidc.com/service-supports/fslog v0.5.9/go.mod h1:/m03ATmmOle75qtEgvEw8a1+Dcg6iHp08M1bGFXJTBU=
+github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
+github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
+github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
+github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=
+github.com/bytedance/sonic v1.10.0 h1:qtNZduETEIWJVIyDl01BeNxur2rW9OwTQ/yBqFRkKEk=
+github.com/bytedance/sonic v1.10.0/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4=
+github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
+github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
+github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0=
+github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpVsBuRksnlj1mLy4AWzRNQYxauNi62uWcE3to6eA=
+github.com/chenzhuoyu/iasm v0.9.0 h1:9fhXjVzq5hUy2gkhhgHl95zG2cEAhw9OSGs8toWWAwo=
+github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
+github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
+github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
+github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
+github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
+github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
+github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
+github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
+github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
+github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
+github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
+github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
+github.com/go-playground/validator/v10 v10.15.3 h1:S+sSpunYjNPDuXkWbK+x+bA7iXiW296KG4dL3X7xUZo=
+github.com/go-playground/validator/v10 v10.15.3/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
+github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
+github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
 github.com/gogo/protobuf v1.3.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE=
 github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
 github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -9,24 +40,68 @@ github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu
 github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
 github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
+github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
+github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
 github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
 github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
+github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
+github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg=
+github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
+github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
 github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
 github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
 github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
-github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
 github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
+github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
+github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
+github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
+github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
+github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
+github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
+github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
 github.com/mwitkow/go-proto-validators v0.3.2 h1:qRlmpTzm2pstMKKzTdvwPCF5QfBNURSlAgN/R+qbKos=
 github.com/mwitkow/go-proto-validators v0.3.2/go.mod h1:ej0Qp0qMgHN/KtDyUt+Q1/tA7a5VarXUOUxD+oeD30w=
+github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
+github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
 github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
+github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
+github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
+github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
+github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
+github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
+github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
+github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
+github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
+github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
+github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
+go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
+go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo=
+go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
+go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
+go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c=
+go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk=
+golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
+golang.org/x/arch v0.5.0 h1:jpGode6huXQxcskEIpOCvrU+tzo81b6+oFLUYXWtH/Y=
+golang.org/x/arch v0.5.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
+golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
+golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
 golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos=
 golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
+golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
 golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
@@ -41,5 +116,13 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
 google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
 google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
+gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
+gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
+rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=

+ 79 - 0
instance.go

@@ -0,0 +1,79 @@
+package dps
+
+import (
+	"git.sxidc.com/service-supports/dps-sdk/client"
+	"git.sxidc.com/service-supports/fslog"
+	"sync"
+)
+
+var dpsClientMutex sync.Mutex
+var dpsClient client.Client
+
+func InitInstance(address string, clientVersion string, databaseID string) error {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return nil
+	}
+
+	c, err := NewClient(address, clientVersion, databaseID)
+	if err != nil {
+		return err
+	}
+
+	dpsClient = c
+
+	return nil
+}
+
+func DestroyInstance(clientVersion string, databaseID string) error {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	err := DestroyClient(clientVersion, databaseID)
+	if err != nil {
+		return err
+	}
+
+	dpsClient = nil
+
+	return nil
+}
+
+func AutoMigrate(items []client.AutoMigrateItem) error {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return nil
+	}
+
+	return dpsClient.AutoMigrate(&client.AutoMigrateRequest{Items: items})
+}
+
+func Transaction(txFunc client.TransactionFunc) error {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return nil
+	}
+
+	return dpsClient.Transaction(txFunc)
+}
+
+func EndTransaction(tx client.Transaction) {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return
+	}
+
+	err := tx.End()
+	if err != nil {
+		fslog.Error("!!!!!!!!! END TRANSACTION" + err.Error() + "!!!!!!!!!")
+		return
+	}
+}

+ 152 - 0
instance_command.go

@@ -0,0 +1,152 @@
+package dps
+
+import (
+	"git.sxidc.com/service-supports/dps-sdk/client"
+	"git.sxidc.com/service-supports/fslog"
+)
+
+func Insert(req *client.InsertRequest, tx client.Transaction) error {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return nil
+	}
+
+	var statement string
+	var err error
+
+	if tx == nil {
+		statement, err = dpsClient.Insert(req)
+	} else {
+		statement, err = tx.InsertTx(req)
+	}
+	if err != nil {
+		return err
+	}
+
+	fslog.Info(statement)
+
+	return nil
+}
+
+func InsertBatch(req *client.InsertBatchRequest, tx client.Transaction) error {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return nil
+	}
+
+	var statement string
+	var err error
+
+	if tx == nil {
+		statement, err = dpsClient.InsertBatch(req)
+	} else {
+		statement, err = tx.InsertBatchTx(req)
+	}
+	if err != nil {
+		return err
+	}
+
+	fslog.Info(statement)
+
+	return nil
+}
+
+func Delete(req *client.DeleteRequest, tx client.Transaction) error {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return nil
+	}
+
+	var statement string
+	var err error
+
+	if tx == nil {
+		statement, err = dpsClient.Delete(req)
+	} else {
+		statement, err = tx.DeleteTx(req)
+	}
+	if err != nil {
+		return err
+	}
+
+	fslog.Info(statement)
+
+	return nil
+}
+
+func DeleteBatch(req *client.DeleteBatchRequest, tx client.Transaction) error {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return nil
+	}
+
+	var statement string
+	var err error
+
+	if tx == nil {
+		statement, err = dpsClient.DeleteBatch(req)
+	} else {
+		statement, err = tx.DeleteBatchTx(req)
+	}
+	if err != nil {
+		return err
+	}
+
+	fslog.Info(statement)
+
+	return nil
+}
+
+func Update(req *client.UpdateRequest, tx client.Transaction) error {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return nil
+	}
+
+	var statement string
+	var err error
+
+	if tx == nil {
+		statement, err = dpsClient.Update(req)
+	} else {
+		statement, err = tx.UpdateTx(req)
+	}
+	if err != nil {
+		return err
+	}
+
+	fslog.Info(statement)
+
+	return nil
+}
+
+func Replay(req *client.ReplayRequest) error {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return nil
+	}
+
+	var statement string
+	var err error
+
+	statement, err = dpsClient.Replay(req)
+	if err != nil {
+		return err
+	}
+
+	fslog.Info(statement)
+
+	return nil
+}

+ 238 - 0
instance_event_query.go

@@ -0,0 +1,238 @@
+package dps
+
+import (
+	"git.sxidc.com/service-supports/dps-sdk/client"
+	"git.sxidc.com/service-supports/fslog"
+)
+
+func EventQueryByKeys(req *client.EventQueryByKeysRequest) ([]client.EventInfo, int64, error) {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return make([]client.EventInfo, 0), 0, nil
+	}
+
+	statement, infos, totalCount, err := dpsClient.EventQueryByKeys(req)
+	if err != nil {
+		return nil, 0, err
+	}
+
+	fslog.Info(statement)
+
+	return infos, totalCount, nil
+}
+
+func CommonEventQuery(req *client.CommonEventQueryRequest) ([]client.EventInfo, int64, error) {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return make([]client.EventInfo, 0), 0, nil
+	}
+
+	statement, infos, totalCount, err := dpsClient.CommonEventQuery(req)
+	if err != nil {
+		return nil, 0, err
+	}
+
+	fslog.Info(statement)
+
+	return infos, totalCount, nil
+}
+
+func CountEventByKeys(req *client.CountEventByKeysRequest) (int64, error) {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return 0, nil
+	}
+
+	statement, count, err := dpsClient.CountEventByKeys(req)
+	if err != nil {
+		return 0, err
+	}
+
+	fslog.Info(statement)
+
+	return count, nil
+}
+
+func CommonCountEvent(req *client.CommonCountEventRequest) (int64, error) {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return 0, nil
+	}
+
+	statement, count, err := dpsClient.CommonCountEvent(req)
+	if err != nil {
+		return 0, err
+	}
+
+	fslog.Info(statement)
+
+	return count, nil
+}
+
+func CheckEventExistByKeys(req *client.CountEventByKeysRequest) (bool, error) {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return false, nil
+	}
+
+	statement, count, err := dpsClient.CountEventByKeys(req)
+	if err != nil {
+		return false, err
+	}
+
+	fslog.Info(statement)
+
+	if count <= 0 {
+		return false, nil
+	}
+
+	return true, nil
+}
+
+func CommonCheckEventExist(req *client.CommonCountEventRequest) (bool, error) {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return false, nil
+	}
+
+	statement, count, err := dpsClient.CommonCountEvent(req)
+	if err != nil {
+		return false, err
+	}
+
+	fslog.Info(statement)
+
+	if count <= 0 {
+		return false, nil
+	}
+
+	return true, nil
+}
+
+func EventHistoryQueryByKeys(req *client.EventQueryByKeysRequest) ([]client.EventInfo, int64, error) {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return make([]client.EventInfo, 0), 0, nil
+	}
+
+	statement, infos, totalCount, err := dpsClient.EventHistoryQueryByKeys(req)
+	if err != nil {
+		return nil, 0, err
+	}
+
+	fslog.Info(statement)
+
+	return infos, totalCount, nil
+}
+
+func CommonEventHistoryQuery(req *client.CommonEventQueryRequest) ([]client.EventInfo, int64, error) {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return make([]client.EventInfo, 0), 0, nil
+	}
+
+	statement, infos, totalCount, err := dpsClient.CommonEventHistoryQuery(req)
+	if err != nil {
+		return nil, 0, err
+	}
+
+	fslog.Info(statement)
+
+	return infos, totalCount, nil
+}
+
+func CountEventHistoryByKeys(req *client.CountEventByKeysRequest) (int64, error) {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return 0, nil
+	}
+
+	statement, count, err := dpsClient.CountEventHistoryByKeys(req)
+	if err != nil {
+		return 0, err
+	}
+
+	fslog.Info(statement)
+
+	return count, nil
+}
+
+func CommonCountEventHistory(req *client.CommonCountEventRequest) (int64, error) {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return 0, nil
+	}
+
+	statement, count, err := dpsClient.CommonCountEventHistory(req)
+	if err != nil {
+		return 0, err
+	}
+
+	fslog.Info(statement)
+
+	return count, nil
+}
+
+func CheckEventHistoryExistByKeys(req *client.CountEventByKeysRequest) (bool, error) {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return false, nil
+	}
+
+	statement, count, err := dpsClient.CountEventHistoryByKeys(req)
+	if err != nil {
+		return false, err
+	}
+
+	fslog.Info(statement)
+
+	if count <= 0 {
+		return false, nil
+	}
+
+	return true, nil
+}
+
+func CommonCheckEventHistoryExist(req *client.CommonCountEventRequest) (bool, error) {
+	dpsClientMutex.Lock()
+	defer dpsClientMutex.Unlock()
+
+	if dpsClient == nil {
+		return false, nil
+	}
+
+	statement, count, err := dpsClient.CommonCountEventHistory(req)
+	if err != nil {
+		return false, err
+	}
+
+	fslog.Info(statement)
+
+	if count <= 0 {
+		return false, nil
+	}
+
+	return true, nil
+}

+ 91 - 0
instance_query.go

@@ -0,0 +1,91 @@
+package dps
+
+import (
+	"git.sxidc.com/service-supports/dps-sdk/client"
+	"git.sxidc.com/service-supports/fslog"
+)
+
+func QueryByWhereAndOrderBy(req *client.QueryByWhereAndOrderByRequest) ([]map[string]any, int64, error) {
+	statement, dataMaps, totalCount, err := dpsClient.QueryByWhereAndOrderBy(req)
+	if err != nil {
+		return nil, 0, err
+	}
+
+	fslog.Info(statement)
+
+	return dataMaps, totalCount, nil
+}
+
+func CommonQuery(req *client.CommonQueryRequest) ([]map[string]any, int64, error) {
+	statement, dataMaps, totalCount, err := dpsClient.CommonQuery(req)
+	if err != nil {
+		return nil, 0, err
+	}
+
+	fslog.Info(statement)
+
+	return dataMaps, totalCount, nil
+}
+
+func QueryByKeys(req *client.QueryByKeysRequest) (map[string]any, error) {
+	statement, dataMap, err := dpsClient.QueryByKeys(req)
+	if err != nil {
+		return nil, err
+	}
+
+	fslog.Info(statement)
+
+	return dataMap, nil
+}
+
+func CountWhere(req *client.CountWhereRequest) (int64, error) {
+	statement, count, err := dpsClient.CountWhere(req)
+	if err != nil {
+		return 0, err
+	}
+
+	fslog.Info(statement)
+
+	return count, nil
+}
+
+func CommonCount(req *client.CommonCountRequest) (int64, error) {
+	statement, count, err := dpsClient.CommonCount(req)
+	if err != nil {
+		return 0, err
+	}
+
+	fslog.Info(statement)
+
+	return count, nil
+}
+
+func CheckExistWhere(req *client.CountWhereRequest) (bool, error) {
+	statement, count, err := dpsClient.CountWhere(req)
+	if err != nil {
+		return false, err
+	}
+
+	fslog.Info(statement)
+
+	if count <= 0 {
+		return false, nil
+	}
+
+	return true, nil
+}
+
+func CommonCheckExist(req *client.CommonCountRequest) (bool, error) {
+	statement, count, err := dpsClient.CommonCount(req)
+	if err != nil {
+		return false, err
+	}
+
+	fslog.Info(statement)
+
+	if count <= 0 {
+		return false, nil
+	}
+
+	return true, nil
+}