1 package graphb 2 3 import ( 4 "regexp" 5 "strings" 6 ) 7 8 // checks the validity of a name according to the spec: http://facebook.github.io/graphql/October2016/#sec-Names 9 var validName = regexp.MustCompile("^[_A-Za-z][_0-9A-Za-z]*$") 10 11 func isValidOperationType(Type operationType) bool { 12 low := strings.ToLower(string(Type)) 13 return low == "query" || low == "mutation" || low == "subscription" 14 } 15 16 const ( 17 // syntax tokens 18 tokenLB = "{" // Left Brace 19 tokenRB = "}" // Right Brace 20 tokenLP = "(" // Left Parenthesis 21 tokenRP = ")" // Right Parenthesis 22 tokenColumn = ":" 23 tokenComma = "," 24 tokenSpace = " " 25 ) 26