dal/pkg/builder/convert_upsert.go
Anton Nesterov 05f155ecc0
[wip] builder
Signed-off-by: Anton Nesterov <anton@demiurg.io>
2024-08-10 00:33:10 +02:00

18 lines
285 B
Go

package builder
import (
"fmt"
"strings"
)
func convertUpsert(keys []string) string {
set := make([]string, 0)
for _, key := range keys {
set = append(set, fmt.Sprintf("%s = EXCLUDED.%s", key, key))
}
return fmt.Sprintf(
"DO UPDATE SET %s",
strings.Join(set, ", "),
)
}