]> 127.0.0.1 Git - part/.git/commitdiff
1 (#8) v0.28.20250113184329
authorqydysky <qydysky@foxmail.com>
Mon, 13 Jan 2025 18:37:20 +0000 (02:37 +0800)
committerGitHub <noreply@github.com>
Mon, 13 Jan 2025 18:37:20 +0000 (02:37 +0800)
log/Log.go

index 9a2f16c6d6583eaf9368400c9f376858ee7fe783..c23460c53293adf564194ba41204e983b1075f3f 100644 (file)
@@ -70,13 +70,6 @@ func New(c Config) (o *Log_interface) {
                Msgs   string
        }
 
-       var replaceF []func(index int, holder string) (replaceTo string)
-       if c.DBDriverName == "postgres" {
-               replaceF = append(replaceF, func(index int, holder string) (replaceTo string) {
-                       return fmt.Sprintf("$%d", index+1)
-               })
-       }
-
        o.MQ.Pull_tag_only(`L`, func(msg Msg_item) bool {
                var showObj = []io.Writer{}
                if msg.Stdout {
@@ -99,6 +92,13 @@ func New(c Config) (o *Log_interface) {
                                sqlTx = psql.BeginTx[any](msg.DBConn, pctx.GenTOCtx(o.DBConnTo))
                        }
 
+                       var replaceF []func(index int, holder string) (replaceTo string)
+                       if c.DBDriverName == "postgres" {
+                               replaceF = append(replaceF, func(index int, holder string) (replaceTo string) {
+                                       return fmt.Sprintf("$%d", index+1)
+                               })
+                       }
+
                        sqlTx.DoPlaceHolder(psql.SqlFunc[any]{Sql: msg.DBInsert}, &LogI{
                                Date:   time.Now().Format(time.DateTime),
                                Unix:   time.Now().Unix(),