From b99cbca10a55735666272124024a3e0ea5db0109 Mon Sep 17 00:00:00 2001
From: dtapps
Date: Sat, 30 Mar 2024 11:06:04 +0800
Subject: [PATCH] - update
---
go.mod | 2 +-
gorm.go | 4 +++-
gorm_gen.go | 4 +++-
gorm_gen_mysql.go | 1 +
gorm_gen_postgres.go | 1 +
gorm_gen_postgresql.go | 1 +
gorm_mysql.go | 1 +
gorm_postgres.go | 1 +
gorm_postgresql.go | 1 +
json.go | 18 ------------------
mongo.go | 3 ++-
xml.go | 21 ---------------------
12 files changed, 15 insertions(+), 43 deletions(-)
delete mode 100644 json.go
delete mode 100644 xml.go
diff --git a/go.mod b/go.mod
index c8e0a22..5ffdbad 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,6 @@ module go.dtapp.net/dorm
go 1.22.1
require (
- github.com/basgys/goxml2json v1.1.0
github.com/redis/go-redis/v9 v9.5.1
github.com/sirupsen/logrus v1.9.3
go.dtapp.net/gojson v1.0.4
@@ -17,6 +16,7 @@ require (
require (
filippo.io/edwards25519 v1.1.0 // indirect
+ github.com/basgys/goxml2json v1.1.0 // indirect
github.com/bytedance/sonic v1.11.3 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
diff --git a/gorm.go b/gorm.go
index 7aa91bd..6bbe7bd 100644
--- a/gorm.go
+++ b/gorm.go
@@ -13,10 +13,12 @@ import (
// GormClientFun *GormClient 驱动
type GormClientFun func() *GormClient
-// GormClientTableFun *GormClient 驱动
+// GormClientTableFun
+// *GormClient 驱动
// string 表名
type GormClientTableFun func() (*GormClient, string)
+// GormClientConfig 配置
type GormClientConfig struct {
Dns string // 地址
LogStatus bool // 日志 - 状态
diff --git a/gorm_gen.go b/gorm_gen.go
index e6dfea1..543c982 100644
--- a/gorm_gen.go
+++ b/gorm_gen.go
@@ -8,10 +8,12 @@ import (
// GormGenClientFun *GormClient 驱动
type GormGenClientFun func() *GormGenClient
-// GormGenClientTableFun *GormClient 驱动
+// GormGenClientTableFun
+// *GormClient 驱动
// string 表名
type GormGenClientTableFun func() (*GormGenClient, string)
+// GormGenClientConfig 配置
type GormGenClientConfig struct {
Dns string // dns地址
Db *gorm.DB // db驱动
diff --git a/gorm_gen_mysql.go b/gorm_gen_mysql.go
index fe9f1e5..adae691 100644
--- a/gorm_gen_mysql.go
+++ b/gorm_gen_mysql.go
@@ -7,6 +7,7 @@ import (
"gorm.io/gorm"
)
+// NewGormGenMysqlClient 创建GormGenClient实例 mysql
func NewGormGenMysqlClient(ctx context.Context, config *GormGenClientConfig) (*GormGenClient, error) {
c := &GormGenClient{config: config}
diff --git a/gorm_gen_postgres.go b/gorm_gen_postgres.go
index 05fe231..c6751e6 100644
--- a/gorm_gen_postgres.go
+++ b/gorm_gen_postgres.go
@@ -7,6 +7,7 @@ import (
"gorm.io/gorm"
)
+// NewGormGenPostgresClient 创建GormGenClient实例 postgres
func NewGormGenPostgresClient(ctx context.Context, config *GormGenClientConfig) (*GormGenClient, error) {
c := &GormGenClient{config: config}
diff --git a/gorm_gen_postgresql.go b/gorm_gen_postgresql.go
index 8d1e0cb..78dd8c7 100644
--- a/gorm_gen_postgresql.go
+++ b/gorm_gen_postgresql.go
@@ -7,6 +7,7 @@ import (
"gorm.io/gorm"
)
+// NewGormGenPostgresqlClient 创建GormGenClient实例 postgresql
func NewGormGenPostgresqlClient(ctx context.Context, config *GormGenClientConfig) (*GormGenClient, error) {
c := &GormGenClient{config: config}
diff --git a/gorm_mysql.go b/gorm_mysql.go
index e3c81bf..54710f7 100644
--- a/gorm_mysql.go
+++ b/gorm_mysql.go
@@ -11,6 +11,7 @@ import (
"time"
)
+// NewGormMysqlClient 创建GormClient实例 mysql
func NewGormMysqlClient(ctx context.Context, config *GormClientConfig) (*GormClient, error) {
var err error
diff --git a/gorm_postgres.go b/gorm_postgres.go
index 55edd78..8d2a2c8 100644
--- a/gorm_postgres.go
+++ b/gorm_postgres.go
@@ -11,6 +11,7 @@ import (
"time"
)
+// NewGormPostgresClient 创建GormClient实例 postgres
func NewGormPostgresClient(ctx context.Context, config *GormClientConfig) (*GormClient, error) {
var err error
diff --git a/gorm_postgresql.go b/gorm_postgresql.go
index 5b9b485..554e656 100644
--- a/gorm_postgresql.go
+++ b/gorm_postgresql.go
@@ -11,6 +11,7 @@ import (
"time"
)
+// NewGormPostgresqlClient 创建GormClient实例 postgresql
func NewGormPostgresqlClient(ctx context.Context, config *GormClientConfig) (*GormClient, error) {
var err error
diff --git a/json.go b/json.go
deleted file mode 100644
index 552b5d6..0000000
--- a/json.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package dorm
-
-import (
- "go.dtapp.net/gojson"
-)
-
-// JsonDecodeNoError json字符串转结构体,不报错
-func JsonDecodeNoError(b []byte) map[string]interface{} {
- var data map[string]interface{}
- _ = gojson.Unmarshal(b, &data)
- return data
-}
-
-// JsonEncodeNoError 结构体转json字符串,不报错
-func JsonEncodeNoError(data interface{}) string {
- jsons, _ := gojson.Marshal(data)
- return string(jsons)
-}
diff --git a/mongo.go b/mongo.go
index 474e81b..94e80b1 100644
--- a/mongo.go
+++ b/mongo.go
@@ -12,7 +12,8 @@ import (
// string 库名
type MongoClientFun func() (*MongoClient, string)
-// MongoClientCollectionFun *MongoClient 驱动
+// MongoClientCollectionFun
+// *MongoClient 驱动
// string 库名
// string 集合
type MongoClientCollectionFun func() (*MongoClient, string, string)
diff --git a/xml.go b/xml.go
deleted file mode 100644
index 02b852e..0000000
--- a/xml.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package dorm
-
-import (
- "github.com/basgys/goxml2json"
- "go.dtapp.net/gojson"
- "strings"
-)
-
-// XmlDecodeNoError xml字符串转结构体,不报错
-func XmlDecodeNoError(b []byte) map[string]interface{} {
- xtj := strings.NewReader(string(b))
- jtx, _ := xml2json.Convert(xtj)
- var data map[string]interface{}
- _ = gojson.Unmarshal(jtx.Bytes(), &data)
- return data
-}
-
-// XmlEncodeNoError 结构体转json字符串,不报错
-func XmlEncodeNoError(data interface{}) string {
- return JsonEncodeNoError(data)
-}