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 ¶ added in v0.17.45
GetTypeInfo - get the imported package & type name combo. package.TypeName
type EntityResolver ¶ added in v0.15.0
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 ¶ added in v0.17.28
func (e *EntityResolver) LookupInputType() string
type Federation ¶ added in v0.17.54
type Federation struct {
Entities []*Entity
RequiresEntities map[string]*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 ¶ added in v0.17.54
func (f *Federation) GenerateCode(data *codegen.Data) error
func (*Federation) InjectSourcesEarly ¶ added in v0.17.54
func (f *Federation) InjectSourcesEarly() ([]*ast.Source, error)
func (*Federation) InjectSourcesLate ¶ added in v0.17.54
InjectSourcesLate creates a GraphQL Entity type with all the fields that had the @key directive
func (*Federation) MutateConfig ¶ added in v0.17.54
func (f *Federation) MutateConfig(cfg *config.Config) error
MutateConfig mutates the configuration
func (*Federation) Name ¶ added in v0.17.54
func (f *Federation) Name() string
Name returns the plugin name
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 ¶ added in v0.17.54
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
// EntityResolverMulti is default engine for entityResolver generation.
// This can be overriding by @entityResolver(multi: Boolean) directive.
// false by default.
EntityResolverMulti bool
}
Click to show internal directories.
Click to hide internal directories.