params.go 442 B

1234567891011121314151617181920
  1. package arango
  2. import (
  3. "regexp"
  4. )
  5. // https://docs.arangodb.com/3.11/aql/fundamentals/bind-parameters/#syntax
  6. var paramRegexp = regexp.MustCompile("@(@?[A-z0-9_]+)")
  7. // ReadParams reads out named parameters from an AQL string.
  8. func ReadParams(input string) []string {
  9. params := []string{}
  10. matches := paramRegexp.FindAllStringSubmatch(input, -1)
  11. for _, match := range matches {
  12. params = append(params, match[1])
  13. }
  14. return params
  15. }