Documentation
¶
Index ¶
- Variables
- func AggregationAugmenter(s *ast.Schema) error
- func FilterArgAugmenter(s *ast.Schema) error
- func FilterInputAugmenter(s *ast.Schema) error
- func Format(resolverPackageDir string, schema *ast.Schema) []*ast.Source
- func Generate(configPath string, generateServer, saveFiles bool, sources ...*ast.Source) error
- func GetDirectiveValue(d *ast.Directive, name string) any
- func GetType(a *ast.Type) *ast.Type
- func ImportPathForDir(dir string) (res string)
- func IsListType(a *ast.Type) bool
- func IsScalarListType(s *ast.Schema, a *ast.Type) bool
- func MutationsAugmenter(s *ast.Schema) error
- func OrderByAugmenter(s *ast.Schema) error
- func PaginationAugmenter(s *ast.Schema) error
- type Aggregation
- type ArgName
- type Augmenter
- type FastGqlPlugin
- func (f *FastGqlPlugin) CreateAugmented(schema *ast.Schema, augmenters ...Augmenter) ([]*ast.Source, error)
- func (f *FastGqlPlugin) GenerateCode(data *codegen.Data) error
- func (f *FastGqlPlugin) Implement(_ string, field *codegen.Field) string
- func (f *FastGqlPlugin) MutateConfig(c *config.Config) error
- func (f *FastGqlPlugin) Name() string
- type FieldAugmenter
- type RelationDirective
- type RelationType
- type TableDirective
Constants ¶
This section is empty.
Variables ¶
var ( //go:embed fastgql.graphql FastGQLSchema string FastGQLDirectives = []string{tableDirectiveName, generateDirectiveName, "generateFilterInput", "isInterfaceFilter", skipGenerateDirectiveName, "generateMutations", relationDirectiveName} )
Functions ¶
func AggregationAugmenter ¶ added in v0.3.0
func FilterArgAugmenter ¶ added in v0.3.0
func FilterInputAugmenter ¶ added in v0.3.0
func Format ¶ added in v0.3.1
Format into multiple source, the original format schema from gqlparser lib saves all in one file, in this case after augmentation we want to keep all original files and structure and all added definitions to put in fastgql_schema.graphql file.
func Generate ¶
Generate generates the schema and the resolver files, if generateServer is true, it will also generate the server file. if saveFiles is true, it will save the generated augmented graphql files to the disk, otherwise it the only be saved in generated code.
func ImportPathForDir ¶ added in v0.3.0
ImportPathForDir takes a path and returns a golang import path for the package
func IsListType ¶ added in v0.3.0
func MutationsAugmenter ¶ added in v0.3.0
func OrderByAugmenter ¶ added in v0.3.0
func PaginationAugmenter ¶ added in v0.3.0
Types ¶
type Aggregation ¶ added in v0.3.0
type Aggregation struct{}
func (Aggregation) DirectiveName ¶ added in v0.3.0
func (a Aggregation) DirectiveName() string
func (Aggregation) Name ¶ added in v0.3.0
func (a Aggregation) Name() string
type Augmenter ¶ added in v0.3.0
Augmenter is a function that modifies the schema, it can be used to add fields, types, etc.
type FastGqlPlugin ¶
type FastGqlPlugin struct {
// contains filtered or unexported fields
}
FastGqlPlugin augments and extends the original schema
func NewFastGQLPlugin ¶ added in v0.3.0
func NewFastGQLPlugin(rootDir, serverFileName string, generateServer bool) *FastGqlPlugin
func (*FastGqlPlugin) CreateAugmented ¶
func (f *FastGqlPlugin) CreateAugmented(schema *ast.Schema, augmenters ...Augmenter) ([]*ast.Source, error)
CreateAugmented augments *ast.Schema returning []*ast.Source files that are augmented with filters, mutations etc' so gqlgen can generate an augmented fastGQL server
func (*FastGqlPlugin) GenerateCode ¶ added in v0.3.0
func (f *FastGqlPlugin) GenerateCode(data *codegen.Data) error
func (*FastGqlPlugin) Implement ¶ added in v0.3.0
func (f *FastGqlPlugin) Implement(_ string, field *codegen.Field) string
func (*FastGqlPlugin) MutateConfig ¶
func (f *FastGqlPlugin) MutateConfig(c *config.Config) error
func (*FastGqlPlugin) Name ¶
func (f *FastGqlPlugin) Name() string
type FieldAugmenter ¶ added in v0.3.0
type FieldAugmenter func(s *ast.Schema, obj *ast.Definition, field *ast.FieldDefinition) error
FieldAugmenter is a function that modifies a field in a schema, it can be used to add arguments, directives, etc.
type RelationDirective ¶ added in v0.3.0
type RelationDirective struct {
RelType RelationType
BaseTable string
ReferenceTable string
Fields []string
References []string
ManyToManyTable string
ManyToManyReferences []string
ManyToManyFields []string
}
func GetRelationDirective ¶ added in v0.3.0
func GetRelationDirective(field *ast.FieldDefinition) *RelationDirective
type RelationType ¶ added in v0.3.0
type RelationType string
const ( OneToMany RelationType = "ONE_TO_MANY" OneToOne RelationType = "ONE_TO_ONE" ManyToMany RelationType = "MANY_TO_MANY" )
type TableDirective ¶ added in v0.3.0
type TableDirective struct {
// Name of the table/collection
Name string
// Schema name table resides in, can be omitted
Schema string
// Dialect name the table resides in
Dialect string
}
func GetTableDirective ¶ added in v0.3.0
func GetTableDirective(def *ast.Definition) (*TableDirective, error)