From: qydysky Date: Mon, 13 Jan 2025 18:37:20 +0000 (+0800) Subject: 1 (#8) X-Git-Tag: v0.28.20250113184329 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=b54a185a0ae695dc25353d5d52fa9440eb6800a3;p=part%2F.git 1 (#8) --- diff --git a/log/Log.go b/log/Log.go index 9a2f16c..c23460c 100644 --- a/log/Log.go +++ b/log/Log.go @@ -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(),