chore: fix postgres stmts

This commit is contained in:
Steven
2024-01-05 21:27:16 +08:00
parent ee13927607
commit 501f8898f6
16 changed files with 589 additions and 672 deletions

View File

@ -1,9 +1,26 @@
package postgres
import "google.golang.org/protobuf/encoding/protojson"
import (
"fmt"
"strings"
"google.golang.org/protobuf/encoding/protojson"
)
var (
protojsonUnmarshaler = protojson.UnmarshalOptions{
DiscardUnknown: true,
}
)
func placeholder(n int) string {
return "$" + fmt.Sprint(n)
}
func placeholders(n int) string {
list := []string{}
for i := 0; i < n; i++ {
list = append(list, placeholder(i+1))
}
return strings.Join(list, ", ")
}