Documentation ¶
Index ¶
- func GetGRPCType(t string) string
- func GetGoGraphQLType(t string) string
- func GetGoType(t string) string
- func GetGraphQLType(t *Field) string
- func IsCompositeType(t string) bool
- type CompositeType
- type Field
- func (f *Field) ArgNames() []string
- func (f *Field) GoInputName(allExported ...bool) string
- func (f *Field) GoName(allExported ...bool) string
- func (f *Field) GoType(args ...bool) string
- func (f *Field) GraphQLFormattedName() string
- func (f *Field) GraphQLFortmattedInputType(args ...bool) string
- func (f *Field) GraphQLFortmattedType(args ...bool) string
- type Query
- type TypeDefs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetGraphQLType ¶
GetGraphQLType returns graphql schema type from matro type
func IsCompositeType ¶
Types ¶
type CompositeType ¶
type CompositeType struct { Name string Fields map[string]*Field ReferedTypes map[string]*CompositeType ParentTypes map[string]*CompositeType IsNode bool IsEdge bool Filters []string GraphqlOps parser.Ops SearchFields []string MutatableFields []string SortBy []string Module *parser.Module AllReferedFields bool HardcodedFilters map[string]string NoGraphql bool IsViewerType bool ViewerRefenceField string }
CompositeType defines a non trivial type with a set of informations like what all fields, opeations supported, etc.
func NewCompositeType ¶
func NewCompositeType(d *parser.Definition, module parser.Module, typesMap map[string]*parser.Type, typeDef *parser.Type) (*CompositeType, error)
NewCompositeType return an instance of the CompositeType
func (*CompositeType) ConnectionName ¶
func (c *CompositeType) ConnectionName() string
ConnectionName returns the connection type name
func (*CompositeType) EdgeFields ¶
func (c *CompositeType) EdgeFields() *utils.Set[string]
EdgeFields return the paginated fields that can be an edge
func (*CompositeType) EdgeName ¶
func (c *CompositeType) EdgeName() string
EdgeName returns the edge type name
func (*CompositeType) FieldType ¶
func (c *CompositeType) FieldType(field string) string
FieldType return the type of the given field
func (*CompositeType) Mutatable ¶
func (c *CompositeType) Mutatable() bool
Mutatable will say this type is mutatable for not
func (*CompositeType) Queries ¶
func (c *CompositeType) Queries() []Query
type Field ¶
type Field struct { Name string Type string GraphQLType string IsList bool IsNullable bool IsPaginated bool MaxCount int IsQuery bool Args []Field IsPrimitive bool IsJoinedData bool IsMutatable bool HardcodedFilters map[string]string NoGraphql bool ViewerRefence bool }
Field defines the field meta data by its type, is it a list, is it nullable etc..
func NewField ¶
func NewField(d *parser.Definition, typesMap map[string]*parser.Type, typeDef *parser.Type, name string, isViewerReferece bool) *Field
TODO(@gokultp) clean up this function, make it more readable NewField returns an instance of the field
func (*Field) GoInputName ¶
GoName return the field name to be used in go code
func (*Field) GoType ¶
GoType return the gotype to be used in go code args[0] graphql enabled args[1] update type
func (*Field) GraphQLFormattedName ¶
GraphQLFormattedName returns the formatted graphql name for the field if it is queiriable it formats like field(args...):Type!
func (*Field) GraphQLFortmattedInputType ¶
TODO: @gokul clean this up GraphQLFortmattedType return the graphql type name
func (*Field) GraphQLFortmattedType ¶
GraphQLFortmattedType return the graphql type name
type Query ¶
type Query struct { *Field Parent *CompositeType }
Query encapsulates a graphql query metadata
type TypeDefs ¶
type TypeDefs struct { Types map[string]*CompositeType Queries []Query QueryTypes map[string]*CompositeType }
TypeDefs encapsulates the list of types it keeps the information in the form of a map of type name to Type struct
func GetTypeDefs ¶
func GetTypeDefs(d *parser.Definition) (*TypeDefs, error)
GetTypeDefs get all typedefs from the parsed json schema