26 lines
464 B
Go
26 lines
464 B
Go
|
package schema
|
||
|
|
||
|
import (
|
||
|
"github.com/samber/lo"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
func PrefixArray(prefix string, values []string) (items []string) {
|
||
|
for _, value := range values {
|
||
|
items = append(items, prefix+" "+value)
|
||
|
}
|
||
|
return items
|
||
|
}
|
||
|
|
||
|
func QuoteString(value any) string {
|
||
|
switch v := value.(type) {
|
||
|
case []string:
|
||
|
return strings.Join(lo.Map(v, func(item string, _ int) string {
|
||
|
return "'" + item + "'"
|
||
|
}), ", ")
|
||
|
case string:
|
||
|
return "'" + v + "'"
|
||
|
}
|
||
|
return ""
|
||
|
}
|