memos/store/db/postgres/common.go

27 lines
408 B
Go
Raw Normal View History

package postgres
2024-01-05 21:27:16 +08:00
import (
"fmt"
"strings"
"google.golang.org/protobuf/encoding/protojson"
)
var (
protojsonUnmarshaler = protojson.UnmarshalOptions{
DiscardUnknown: true,
}
)
2024-01-05 21:27:16 +08:00
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, ", ")
}