Documentation
¶
Index ¶
- Constants
- Variables
- func CheckValueSpec(valueSpec *ast.ValueSpec) bool
- func CreateParentsMap(graph map[string]Node) map[string]NodeHelper
- func FillEmptyTag(ts *structtag.Tags, n, tag string) *structtag.Tags
- func GetChildFields(n *ast.TypeSpec) []*ast.Field
- func GetFieldAnnotationString(f *ast.Field, annotation FieldAnnotation) string
- func GetFieldAnnotationVal(f *ast.Field, annotation FieldAnnotation) string
- func GetFieldJsonTag(f *ast.Field) *structtag.Tag
- func GetFieldName(f *ast.Field) (string, error)
- func GetFieldNameJsonTag(f *ast.Field) string
- func GetFieldTags(f *ast.Field) *structtag.Tags
- func GetFieldType(f *ast.Field) string
- func GetGraphqlQuerySpecs(queryMap map[string]nexus.GraphQLQuerySpec, p Package)
- func GetGraphqlSpecs(graphQLSpecMap map[string]nexus.GraphQLSpec, p Package)
- func GetLinkFields(n *ast.TypeSpec) []*ast.Field
- func GetModulePath(startPath string) string
- func GetNexusDescriptionAnnotation(pkg Package, name string) (string, bool)
- func GetNexusFields(n *ast.TypeSpec) []*ast.Field
- func GetNexusGraphqlAnnotation(pkg Package, name string) (string, bool)
- func GetNexusGraphqlSpecAnnotation(pkg Package, name string) (string, bool)
- func GetNexusRestAPIGenAnnotation(pkg Package, name string) (string, bool)
- func GetNexusSecretSpecAnnotation(pkg Package, name string) (string, bool)
- func GetNodeFieldName(f *ast.Field) (string, error)
- func GetSpecFields(n *ast.TypeSpec) []*ast.Field
- func GetStatusField(n *ast.TypeSpec) *ast.Field
- func GetTypeName(n *ast.TypeSpec) string
- func IgnoreField(f *ast.Field) bool
- func IsArrayField(f *ast.Field) bool
- func IsChildField(f *ast.Field) bool
- func IsFieldAnnotationPresent(f *ast.Field, annotation FieldAnnotation) bool
- func IsFieldPointer(f *ast.Field) bool
- func IsJsonStringField(f *ast.Field) bool
- func IsLinkField(f *ast.Field) bool
- func IsMapField(f *ast.Field) bool
- func IsNamedChildOrLink(f *ast.Field) bool
- func IsNexusField(f *ast.Field) bool
- func IsNexusGraphqlNullField(f *ast.Field) bool
- func IsNexusNode(n *ast.TypeSpec) bool
- func IsNexusTypeField(f *ast.Field) bool
- func IsOnlyChildField(f *ast.Field) bool
- func IsOnlyChildrenField(f *ast.Field) bool
- func IsOnlyLinkField(f *ast.Field) bool
- func IsPointerToArrayField(f *ast.Field) bool
- func IsSingletonNode(n *ast.TypeSpec) bool
- func IsStatusField(f *ast.Field) bool
- func ParseFieldTags(tag string) *structtag.Tags
- func ParseGenDecls(v *ast.Package, pkg *Package)
- func ParseGraphQLFiles(startPath string) map[string]string
- func ParseGraphqlQuerySpecs(pkgs Packages) map[string]nexus.GraphQLQuerySpec
- func ParseGraphqlSpecs(pkgs Packages) map[string]nexus.GraphQLSpec
- func SpecialCharsPresent(name string) bool
- type FieldAnnotation
- type GraphQlArg
- type HTTPCodesResponse
- type HTTPMethod
- type HTTPMethodsResponses
- type HTTPResponse
- type NexusSpec
- type Node
- type NodeHelper
- type NodeHelperChild
- type NonNexusTypes
- type Package
- func (p *Package) GenDeclToString(t *ast.GenDecl) (string, error)
- func (p *Package) GetConsts() []*ast.ValueSpec
- func (p *Package) GetImportMap() map[string]string
- func (p *Package) GetImportStrings() []string
- func (p *Package) GetImports() []*ast.ImportSpec
- func (p *Package) GetNexusNodes() []*ast.TypeSpec
- func (p *Package) GetNodes() []*ast.TypeSpec
- func (p *Package) GetNonStructTypes() []*ast.TypeSpec
- func (p *Package) GetStructs() []*ast.TypeSpec
- func (p *Package) GetTypes() []ast.GenDecl
- func (p *Package) IsVarPresent(varName string) bool
- func (p *Package) TypeSpecToString(t *ast.TypeSpec) (string, error)
- func (p *Package) ValueSpecToString(t *ast.ValueSpec) (string, error)
- type PackageNodeRelation
- type Packages
- type ResponseCode
- type RestAPISpec
- type RestURIs
Constants ¶
View Source
const ( NexusRestApiGenAnnotation = "nexus-rest-api-gen" NexusDescriptionAnnotation = "nexus-description" NexusGraphqlAnnotation = "nexus-graphql-query" NexusSecretSpecAnnotation = "nexus-secret-spec" NexusGraphqlSpecAnnotation = "nexus-graphql-spec" )
View Source
const ( GRAPHQL_ARGS_ANNOTATION = FieldAnnotation("nexus-graphql-args") GRAPHQL_ALIAS_NAME_ANNOTATION = FieldAnnotation("nexus-alias-name") GRAPHQL_ALIAS_TYPE_ANNOTATION = FieldAnnotation("nexus-alias-type") GRAPHQL_TSM_DIRECTIVE_ANNOTATION = FieldAnnotation("nexus-graphql-tsm-directive") GRAPHQL_NULLABLE_ANNOTATION = FieldAnnotation("nexus-graphql-nullable") GRAPHQL_TS_TYPE_ANNOTATION = FieldAnnotation("nexus-graphql-ts-type") GRAPHQL_JSONENCODED_ANNOTATION = FieldAnnotation("nexus-graphql-jsonencoded") GRAPHQL_RELATION_NAME = FieldAnnotation("nexus-graphql-relation-name") GRAPHQL_RELATION_PARAMETERS = FieldAnnotation("nexus-graphql-relation-parameters") GRAPHQL_RELATION_UUIDKEY = FieldAnnotation("nexus-graphql-relation-uuidkey") GRAPHQL_TYPE_NAME = FieldAnnotation("nexus-graphql-type-name") GRAPHQL_PROTOBUF_NAME = FieldAnnotation("nexus-graphql-protobuf-name") GRAPHQL_PROTOBUF_FILE = FieldAnnotation("nexus-graphql-protobuf-file") )
Variables ¶
View Source
var ReservedTypeNames = []string{"ResourceVersion", "SchemeGroupVersion", "Kind", "Resource", "SchemeBuilder",
"AddToScheme", "Child", "Link", "NexusStatus"}
Functions ¶
func CheckValueSpec ¶
func CreateParentsMap ¶
func CreateParentsMap(graph map[string]Node) map[string]NodeHelper
func GetFieldAnnotationString ¶
func GetFieldAnnotationString(f *ast.Field, annotation FieldAnnotation) string
func GetFieldAnnotationVal ¶
func GetFieldAnnotationVal(f *ast.Field, annotation FieldAnnotation) string
func GetFieldNameJsonTag ¶
func GetFieldType ¶
func GetGraphqlQuerySpecs ¶
func GetGraphqlQuerySpecs(queryMap map[string]nexus.GraphQLQuerySpec, p Package)
func GetGraphqlSpecs ¶
func GetGraphqlSpecs(graphQLSpecMap map[string]nexus.GraphQLSpec, p Package)
func GetModulePath ¶
func GetTypeName ¶
func IgnoreField ¶
func IsArrayField ¶
func IsChildField ¶
func IsFieldAnnotationPresent ¶
func IsFieldAnnotationPresent(f *ast.Field, annotation FieldAnnotation) bool
func IsFieldPointer ¶
func IsJsonStringField ¶
func IsLinkField ¶
func IsMapField ¶
func IsNamedChildOrLink ¶
func IsNexusField ¶
func IsNexusGraphqlNullField ¶
func IsNexusNode ¶
func IsNexusTypeField ¶
func IsOnlyChildField ¶
func IsOnlyChildrenField ¶
func IsOnlyLinkField ¶
func IsPointerToArrayField ¶
func IsSingletonNode ¶
func IsStatusField ¶
func ParseFieldTags ¶
func ParseGenDecls ¶
func ParseGraphQLFiles ¶
ParseDSLNodes walks recursively through given path and looks for structs types definitions to add them to graph
func ParseGraphqlQuerySpecs ¶
func ParseGraphqlQuerySpecs(pkgs Packages) map[string]nexus.GraphQLQuerySpec
func ParseGraphqlSpecs ¶
func ParseGraphqlSpecs(pkgs Packages) map[string]nexus.GraphQLSpec
func SpecialCharsPresent ¶
Types ¶
type FieldAnnotation ¶
type FieldAnnotation string
type GraphQlArg ¶
type HTTPCodesResponse ¶
type HTTPCodesResponse map[ResponseCode]HTTPResponse
HTTPCodesResponse code to response type.
type HTTPMethodsResponses ¶
type HTTPMethodsResponses map[HTTPMethod]HTTPCodesResponse
HTTPMethodsResponses to response mapping.
type HTTPResponse ¶
type HTTPResponse struct {
Description string `json:"description"`
}
HTTPResponse type.
type Node ¶
type Node struct { Name string PkgName string FullName string CrdName string IsSingleton bool Imports []*ast.ImportSpec TypeSpec *ast.TypeSpec Parents []string SingleChildren map[string]Node MultipleChildren map[string]Node SingleLink map[string]Node MultipleLink map[string]Node GraphqlQuerySpec nexus.GraphQLQuerySpec GraphqlSpec nexus.GraphQLSpec }
type NodeHelper ¶
type NodeHelper struct { Name string RestName string Parents []string Children map[string]NodeHelperChild // CRD Name => NodeHelperChild Links map[string]NodeHelperChild // FieldName => NodeHelperChild RestMappings map[string]string IsSingleton bool GraphqlQuerySpec nexus.GraphQLQuerySpec GraphqlSpec nexus.GraphQLSpec }
type NodeHelperChild ¶
type NonNexusTypes ¶
func ParseDSLNodes ¶
func ParseDSLNodes(startPath string, baseGroupName string, packages Packages, graphqlQueries map[string]nexus.GraphQLQuerySpec) (map[string]Node, *NonNexusTypes, *token.FileSet)
ParseDSLNodes walks recursively through given path and looks for structs types definitions to add them to graph
type Package ¶
type Package struct { Name string FullName string Dir string //new fields ModPath string Pkg ast.Package GenDecls []ast.GenDecl FileSet *token.FileSet }
func (*Package) GetImportMap ¶
func (*Package) GetImportStrings ¶
func (*Package) GetImports ¶
func (p *Package) GetImports() []*ast.ImportSpec
func (*Package) GetNexusNodes ¶
func (*Package) GetNonStructTypes ¶
func (*Package) GetStructs ¶
func (*Package) IsVarPresent ¶
func (*Package) TypeSpecToString ¶
type PackageNodeRelation ¶
type Packages ¶
func ParseDSLPkg ¶
ParseDSLPkg walks recursively through given path and looks for structs types definitions to add them to a Package map
type RestAPISpec ¶
type RestAPISpec struct {
Uris []RestURIs `json:"uris"`
}
type RestURIs ¶
type RestURIs struct { Uri string `json:"uri"` Methods HTTPMethodsResponses `json:"methods"` }
RestURIs and associated data.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.