Documentation ¶
Index ¶
- Constants
- type Entity
- type EntityResolver
- type Federation
- func (f *Federation) GenerateCode(data *codegen.Data) error
- func (f *Federation) InjectSourcesEarly() ([]*ast.Source, error)
- func (f *Federation) InjectSourcesLate(schema *ast.Schema) ([]*ast.Source, error)
- func (f *Federation) MutateConfig(cfg *config.Config) error
- func (f *Federation) Name() string
- type KeyField
- type PackageOptions
- type Requires
Constants ¶
View Source
const DirArgFields = "fields"
The fields arguments must be provided to both key and requires directives.
View Source
const DirArgType = "type"
Tells the code generator what type the directive is referencing
View Source
const DirNameEntityReference = "entityReference"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entity ¶
type Entity struct { Name string // The same name as the type declaration Def *ast.Definition Resolvers []*EntityResolver Requires []*Requires Multi bool Type types.Type }
Entity represents a federated type that was declared in the GQL schema.
func (Entity) GetTypeInfo ¶
GetTypeInfo - get the imported package & type name combo. package.TypeName
type EntityResolver ¶
type EntityResolver struct { ResolverName string // The resolver name, such as FindUserByID KeyFields []*KeyField // The fields declared in @key. InputType types.Type // The Go generated input type for multi entity resolvers InputTypeName string ReturnType types.Type // The Go generated return type for the entity ReturnTypeName string }
func (*EntityResolver) LookupInputType ¶
func (e *EntityResolver) LookupInputType() string
type Federation ¶
type Federation struct { Entities []*Entity PackageOptions PackageOptions // contains filtered or unexported fields }
func New ¶
func New(version int, cfg *config.Config) (*Federation, error)
New returns a federation plugin that injects federated directives and types into the schema
func (*Federation) GenerateCode ¶
func (f *Federation) GenerateCode(data *codegen.Data) error
func (*Federation) InjectSourcesEarly ¶
func (f *Federation) InjectSourcesEarly() ([]*ast.Source, error)
func (*Federation) InjectSourcesLate ¶
InjectSourceLate creates a GraphQL Entity type with all the fields that had the @key directive
func (*Federation) MutateConfig ¶
func (f *Federation) MutateConfig(cfg *config.Config) error
MutateConfig mutates the configuration
type KeyField ¶
type KeyField struct { Definition *ast.FieldDefinition Field fieldset.Field // len > 1 for nested fields Type *config.TypeReference // The Go representation of that field type }
type PackageOptions ¶
type PackageOptions struct { // ExplicitRequires will generate a function in the execution context // to populate fields using the @required directive into the entity. // // You can only set one of ExplicitRequires or ComputedRequires to true. ExplicitRequires bool // ComputedRequires generates resolver functions to compute values for // fields using the @required directive. ComputedRequires bool }
Click to show internal directories.
Click to hide internal directories.