Documentation ¶
Index ¶
- func FindFunction(code, pkgName, fnName string) (*packages.Package, *ast.FuncDecl, error)
- func FindFunctionFromParser(parser Parser, fss ...FunctionSearch) (*packages.Package, map[string]*ast.FuncDecl, error)
- func FindFunctions(code, pkgName string, fnNames ...string) (*packages.Package, map[string]*ast.FuncDecl, error)
- func GetNodeNameFromEntConfig(configName string) (string, error)
- func LoadPackage(p Parser) (*packages.Package, error)
- func LoadPackageX(p Parser) *packages.Package
- func LoadPackages(p Parser) ([]*packages.Package, error)
- func LoadPackagesX(p Parser) []*packages.Package
- func ParseCustomGraphQLDefinitions(parser Parser, codeParser CustomCodeParser) chan ParseCustomGQLResult
- type ConfigSchemaParser
- type CustomCodeParser
- type CustomCodeParserWithReceiver
- type EntConfigInfo
- type Field
- type Function
- type FunctionMap
- type FunctionSearch
- type GraphQLCommentGroup
- type Object
- type ParseCustomGQLResult
- type Parser
- type ParserNeedsCleanup
- type SourceSchemaParser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindFunction ¶
func FindFunctionFromParser ¶
func FindFunctions ¶
func GetNodeNameFromEntConfig ¶ added in v0.0.38
func LoadPackageX ¶
func LoadPackagesX ¶
func ParseCustomGraphQLDefinitions ¶
func ParseCustomGraphQLDefinitions(parser Parser, codeParser CustomCodeParser) chan ParseCustomGQLResult
ParseCustomGraphQLDefinitions takes a file Parser and a custom code Parser and returns a channel to the result
Types ¶
type ConfigSchemaParser ¶
type CustomCodeParser ¶
type CustomCodeParser interface { // ReceiverRequired validates if the receiver of a function is required or not // e.g. can the function be a standalone function or does it have to be a method? // To further process if the method is of a valid struct, see CustomCodeParserWithReceiver // where we can evaluate to see that only methods of acceptable structs are parsed // A return value of true indicates it's a method and not a function ReceiverRequired() bool // ProcessFileName is used to indicate if the filename should be evaluated. // eg.. don't process these generated files since there wouldn't be any custom functions there // A return value of true indicates the file will be processed ProcessFileName(string) bool // TODO document CreatesComplexTypeForSingleResult() bool }
CustomCodeParser is used to configure the parsing process
type CustomCodeParserWithReceiver ¶
type CustomCodeParserWithReceiver interface { CustomCodeParser ValidateFnReceiver(name string) error }
CustomCodeParserWithReceiver is for extra validation of the method see CustomCodeParser.ReceiverRequired
type EntConfigInfo ¶
type EntConfigInfo struct { PackageName string `json:"packageName"` ConfigName string `json:"configName"` }
TODO kill this
func GetEntConfigFromEntConfig ¶
func GetEntConfigFromEntConfig(configName string) (*EntConfigInfo, error)
func GetEntConfigFromName ¶
func GetEntConfigFromName(packageName string) *EntConfigInfo
type Field ¶
type Field struct { // Name of the field in argument or return list Name string Type enttype.Type // contains filtered or unexported fields }
Field represents an item in an argument list or return list for a function
type Function ¶
type Function struct { // e.g. User/Contact etc NodeName string // GraphQLName is the name of the Field in GraphQL GraphQLName string // FunctionName is the function that should be called in codegen. It includes the package if not in the "graphql" FunctionName string // Args are the arguments to the function Args []*Field // Results shows the list of return values of the function. Results []*Field // PackagePath is the package path as used by the go/types package. PackagePath string // CommentGroup return the comments associated with this function CommentGroup *GraphQLCommentGroup }
Function represents a function that's parsed and needs to be represented in GraphQL
type FunctionMap ¶
FunctionMap is a Map of GraphQL Type to list of Functions that need to be added to GQL
type FunctionSearch ¶
type GraphQLCommentGroup ¶
type GraphQLCommentGroup struct {
// contains filtered or unexported fields
}
func (*GraphQLCommentGroup) DisableGraphQLInputType ¶
func (doc *GraphQLCommentGroup) DisableGraphQLInputType() bool
func (*GraphQLCommentGroup) GetGraphQLType ¶
func (doc *GraphQLCommentGroup) GetGraphQLType() string
type ParseCustomGQLResult ¶
type ParseCustomGQLResult struct { Functions FunctionMap Error error Objects []*Object }
ParseCustomGQLResult is the result object of parsing the code path given
type ParserNeedsCleanup ¶
type ParserNeedsCleanup interface { Parser Cleanup() }
type SourceSchemaParser ¶
type SourceSchemaParser struct { Sources map[string]string PackageName string // defaults to configs if not passed // contains filtered or unexported fields }
func (*SourceSchemaParser) Cleanup ¶
func (p *SourceSchemaParser) Cleanup()
Click to show internal directories.
Click to hide internal directories.