This repository has been archived on 2026-10-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
aql/params.go
T

23 lines
469 B
Go
Raw Normal View History

2023-10-07 10:22:56 +01:00
package arango
import (
"regexp"
)
// https://docs.arangodb.com/3.11/aql/fundamentals/bind-parameters/#syntax
2023-10-13 07:59:04 +01:00
var paramRegexp = regexp.MustCompile("@(@?[A-z0-9_]+)")
2023-10-07 10:22:56 +01:00
// ReadParams reads out named parameters from an AQL string.
func ReadParams(input string) []string {
params := []string{}
matches := paramRegexp.FindAllStringSubmatch(input, -1)
if matches != nil {
for _, match := range matches {
params = append(params, match[1])
}
}
return params
}