2024-08-09 19:14:28 +00:00
|
|
|
package builder
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2024-08-09 22:33:10 +00:00
|
|
|
func convertUpsert(keys []string) string {
|
2024-08-09 19:14:28 +00:00
|
|
|
set := make([]string, 0)
|
|
|
|
for _, key := range keys {
|
|
|
|
set = append(set, fmt.Sprintf("%s = EXCLUDED.%s", key, key))
|
|
|
|
}
|
|
|
|
return fmt.Sprintf(
|
2024-08-09 22:33:10 +00:00
|
|
|
"DO UPDATE SET %s",
|
2024-08-09 19:14:28 +00:00
|
|
|
strings.Join(set, ", "),
|
|
|
|
)
|
|
|
|
}
|