bob/placeholder.go

23 lines
367 B
Go
Raw Normal View History

2021-06-24 07:43:28 +00:00
package bob
2021-06-25 17:04:41 +00:00
import "strings"
const (
Question = "?"
Dollar = "$"
Colon = ":"
AtP = "@p"
)
2021-06-24 07:43:28 +00:00
type PlaceholderFormat interface {
ReplacePlaceholders(sql string) (string, error)
}
2021-06-25 17:04:41 +00:00
// TODO - test this one
func ReplacePlaceholder(sql string, format string) string {
if format == "" {
format = Question
}
return strings.ReplaceAll(sql, "?", format)
}