 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
Constants ¶
This section is empty.
Variables ¶
      View Source
      
  
    var QueryConstNameRegex *regexp.Regexp = func() *regexp.Regexp { return regexp.MustCompile(".*Query(Fragment)?[_0-9]*$") }()
      View Source
      
  var SubstitutionRegex *regexp.Regexp = func() *regexp.Regexp { rawIdentifier := `[a-zA-Z_][a-zA-Z0-9_]*` typeName := fmt.Sprintf(`(\*?%s\.)?[a-zA-Z0-9_*\[\] ]+`, rawIdentifier) return regexp.MustCompile(fmt.Sprintf( `{{\s*(%s)\s*:\s*(%s)\s*(:\s*(%%(.+?))\s*)?}}`, rawIdentifier, typeName)) }()
SubstitutionRegex represents interpolation syntax. Conceptually, the following syntaxes are allowed
{{ fieldName : typeName }}
{{ fieldName : _ }} // allowed for 2nd, 3rd etc. interpolation of same field
formatSpec must not contain positional arguments (i.e. %[0]f is not OK)
Functions ¶
Types ¶
type GoStruct ¶
type GoStruct struct {
	TypeName string
	Fields   []GoStructField
}
    type GoStructField ¶
type GoStructFieldBuilder ¶
GoStructFieldBuilder maps N-1 to GoStructField, as the same field may be interpolated multiple times in the same query.
func NewFieldBuilder ¶
func NewFieldBuilder(matchIndex int, matches []string) GoStructFieldBuilder
type PosToDefMap ¶
type QueryGenVisitor ¶
type QueryGenVisitor struct {
	// ParamStructs is the list of GoStructs generated for a file.
	ParamStructs []GoStruct
	// contains filtered or unexported fields
}
    func NewQueryGenVisitor ¶
func NewQueryGenVisitor(logger *log.Logger, pass *analysis.Pass) *QueryGenVisitor
type Set ¶
type Set[T comparable] map[T]struct{}
type StructFactory ¶
func (*StructFactory) NewGoStruct ¶
func (factory *StructFactory) NewGoStruct(subregex *regexp.Regexp, queryConst *ast.Ident, templateText string) (*GoStruct, error)
NewGoStruct attempts to build a GoStruct from the given query string.
There are 3 outcomes: 1. If the query was using string interpolation and is well-formed: returns a GoStruct 2. If the query was using string interpolation and is ill-formed: returns nil, err 3. If the query was not using string interpolation: returns nil, nil
 Click to show internal directories. 
   Click to hide internal directories.