mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-12 19:55:14 +02:00
15 lines
300 B
Go
15 lines
300 B
Go
// Phase 21 — gqlgen benign control.
|
|
package benign
|
|
|
|
// import "github.com/99designs/gqlgen/graphql"
|
|
|
|
import "regexp"
|
|
|
|
var idAllow = regexp.MustCompile(`^[A-Za-z0-9_-]+$`)
|
|
|
|
func ResolveUser(id string) (string, error) {
|
|
if !idAllow.MatchString(id) {
|
|
return "", nil
|
|
}
|
|
return "user-" + id, nil
|
|
}
|