super-graph/psql/utils.go

14 lines
289 B
Go
Raw Permalink Normal View History

2019-03-24 23:16:03 +01:00
package psql
import "regexp"
func NewVariables(varlist map[string]string) map[string]string {
re := regexp.MustCompile(`(?mi)\$([a-zA-Z0-9_.]+)`)
2019-04-07 07:12:11 +02:00
vars := make(map[string]string, len(varlist))
2019-03-24 23:16:03 +01:00
for k, v := range varlist {
vars[k] = re.ReplaceAllString(v, `{{$1}}`)
}
return vars
}