Documentation ¶
Index ¶
- Constants
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func GoPackageByPath(path, vendorPath string) (string, error)
- func GqlBoolTypeResolver(ctx BodyContext) string
- func GqlBytesTypeResolver(ctx BodyContext) string
- func GqlDateTimeTypeResolver(ctx BodyContext) string
- func GqlFloat32TypeResolver(ctx BodyContext) string
- func GqlFloat64TypeResolver(ctx BodyContext) string
- func GqlFloatTypeResolver(ctx BodyContext) string
- func GqlInt32TypeResolver(ctx BodyContext) string
- func GqlInt64TypeResolver(ctx BodyContext) string
- func GqlIntTypeResolver(ctx BodyContext) string
- func GqlMultipartFileTypeResolver(ctx BodyContext) string
- func GqlNoDataTypeResolver(ctx BodyContext) string
- func GqlStringTypeResolver(ctx BodyContext) string
- func GqlUInt32TypeResolver(ctx BodyContext) string
- func GqlUInt64TypeResolver(ctx BodyContext) string
- func MustAsset(name string) []byte
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type AssigningWrapper
- type BodyContext
- type ClientMethodCaller
- type DataLoaderField
- type Enum
- type EnumValue
- type GoType
- type InputObject
- type InputObjectResolver
- type InputObjectResolverField
- type InputObjectResolverOneOf
- type InputObjectResolverOneOfField
- type MapInputObject
- type MapInputObjectResolver
- type MapOutputObject
- type Method
- type MethodArgument
- type ObjectField
- type OutputObject
- type OutputObjectFieldRender
- type PayloadErrorAccessor
- type PayloadErrorChecker
- type Plugin
- func (p *Plugin) AddOutputObjectFieldRenderer(renderer OutputObjectFieldRender)
- func (p *Plugin) AddTypesFile(outputPath string, file *TypesFile)
- func (p *Plugin) Generate() error
- func (p *Plugin) Infos() map[string]string
- func (p *Plugin) Init(config *generator.GenerateConfig, plugins []generator.Plugin) error
- func (p Plugin) Name() string
- func (p *Plugin) Prepare() error
- func (p *Plugin) PrintInfo(infos generator.Infos)
- func (p *Plugin) SchemasObjects() ([]SchemaObjects, error)
- func (p *Plugin) Types() map[string]*TypesFile
- type RenderFieldsContext
- type SchemaBodyContext
- type SchemaConfig
- type SchemaNodeConfig
- type SchemaObjects
- type SchemaParserObjects
- type SchemaService
- type Service
- type ServiceContext
- type TypeResolver
- type TypesFile
- type ValueResolver
Constants ¶
const ( SchemaNodeTypeObject = "OBJECT" SchemaNodeTypeService = "SERVICE" )
const ( PluginName = "graphql" SchemasConfigsKey = "graphql_schemas" )
const ( ScalarsPkgPath = "github.com/EGT-Ukraine/go2gql/api/scalars" MultipartFilePkgPath = "github.com/EGT-Ukraine/go2gql/api/multipartfile" InterceptorsPkgPath = "github.com/EGT-Ukraine/go2gql/api/interceptors" GraphqlPkgPath = "github.com/graphql-go/graphql" OpentracingPkgPath = "github.com/opentracing/opentracing-go" ErrorsPkgPath = "github.com/pkg/errors" LogPkg = "github.com/opentracing/opentracing-go/log" )
const KindBytes = reflect.Kind(255)
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func GoPackageByPath ¶
func GqlBoolTypeResolver ¶
func GqlBoolTypeResolver(ctx BodyContext) string
func GqlBytesTypeResolver ¶
func GqlBytesTypeResolver(ctx BodyContext) string
func GqlDateTimeTypeResolver ¶
func GqlDateTimeTypeResolver(ctx BodyContext) string
func GqlFloat32TypeResolver ¶
func GqlFloat32TypeResolver(ctx BodyContext) string
func GqlFloat64TypeResolver ¶
func GqlFloat64TypeResolver(ctx BodyContext) string
func GqlFloatTypeResolver ¶
func GqlFloatTypeResolver(ctx BodyContext) string
func GqlInt32TypeResolver ¶
func GqlInt32TypeResolver(ctx BodyContext) string
func GqlInt64TypeResolver ¶
func GqlInt64TypeResolver(ctx BodyContext) string
func GqlIntTypeResolver ¶
func GqlIntTypeResolver(ctx BodyContext) string
func GqlMultipartFileTypeResolver ¶
func GqlMultipartFileTypeResolver(ctx BodyContext) string
func GqlNoDataTypeResolver ¶
func GqlNoDataTypeResolver(ctx BodyContext) string
func GqlStringTypeResolver ¶
func GqlStringTypeResolver(ctx BodyContext) string
func GqlUInt32TypeResolver ¶
func GqlUInt32TypeResolver(ctx BodyContext) string
func GqlUInt64TypeResolver ¶
func GqlUInt64TypeResolver(ctx BodyContext) string
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
Types ¶
type AssigningWrapper ¶
type AssigningWrapper func(arg string, ctx BodyContext) string
type BodyContext ¶
type BodyContext struct { File *TypesFile Importer *importer.Importer TracerEnabled bool OutputFieldRenderers []OutputObjectFieldRender }
type ClientMethodCaller ¶
type ClientMethodCaller func(client string, req string, ctx BodyContext) string
type DataLoaderField ¶
type GoType ¶
type InputObject ¶
type InputObject struct { VariableName string GraphQLName string Fields []ObjectField }
type InputObjectResolver ¶
type InputObjectResolver struct { FunctionName string OutputGoType GoType Fields []InputObjectResolverField OneOfFields []InputObjectResolverOneOf }
type InputObjectResolverOneOf ¶
type InputObjectResolverOneOf struct { OutputFieldName string Fields []InputObjectResolverOneOfField }
type InputObjectResolverOneOfField ¶
type InputObjectResolverOneOfField struct { GraphQLInputFieldName string ValueResolver ValueResolver ResolverWithError bool AssigningWrapper AssigningWrapper }
type MapInputObject ¶
type MapInputObject struct { VariableName string GraphQLName string KeyObjectType TypeResolver ValueObjectType TypeResolver }
type MapInputObjectResolver ¶
type MapInputObjectResolver struct { FunctionName string KeyGoType GoType ValueGoType GoType KeyResolver ValueResolver KeyResolverWithError bool ValueResolver ValueResolver ValueResolverWithError bool }
type MapOutputObject ¶
type MapOutputObject struct { VariableName string GraphQLName string KeyObjectType TypeResolver ValueObjectType TypeResolver ValueResolver ValueResolver }
type Method ¶
type Method struct { OriginalName string Name string QuotedComment string GraphQLOutputType TypeResolver Arguments []MethodArgument RequestResolver ValueResolver RequestResolverWithErr bool ClientMethodCaller ClientMethodCaller RequestType GoType PayloadErrorChecker PayloadErrorChecker PayloadErrorAccessor PayloadErrorAccessor }
type MethodArgument ¶
type MethodArgument struct { Name string Type TypeResolver QuotedComment string }
type ObjectField ¶
type ObjectField struct { Name string Type TypeResolver GoType GoType QuotedComment string Value ValueResolver NeedCast bool CastTo GoType }
type OutputObject ¶
type OutputObject struct { VariableName string GraphQLName string GoType GoType Fields []ObjectField DataLoaderFields []*DataLoaderField // TODO: move to dataloader plugin MapFields []ObjectField }
func (*OutputObject) FindFieldByName ¶
func (s *OutputObject) FindFieldByName(name string) *ObjectField
type OutputObjectFieldRender ¶
type OutputObjectFieldRender interface {
RenderFields(o OutputObject, ctx BodyContext) (string, error)
}
type PayloadErrorAccessor ¶
type PayloadErrorChecker ¶
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
func (*Plugin) AddOutputObjectFieldRenderer ¶
func (p *Plugin) AddOutputObjectFieldRenderer(renderer OutputObjectFieldRender)
func (*Plugin) AddTypesFile ¶
func (*Plugin) SchemasObjects ¶
func (p *Plugin) SchemasObjects() ([]SchemaObjects, error)
SchemasObjects returns info about schemas objects. Useful in external plugins.
type RenderFieldsContext ¶
type RenderFieldsContext struct { OutputObject OutputObject ObjectContext BodyContext }
type SchemaBodyContext ¶
type SchemaBodyContext struct { File SchemaConfig Importer *importer.Importer SchemaName string Services []SchemaService QueryObject string MutationObject string Objects []*gqlObject TracerEnabled bool }
type SchemaConfig ¶
type SchemaConfig struct { Name string `mapstructure:"name"` OutputPath string `mapstructure:"output_path"` OutputPackage string `mapstructure:"output_package"` Queries *SchemaNodeConfig `mapstructure:"queries"` Mutations *SchemaNodeConfig `mapstructure:"mutations"` }
type SchemaNodeConfig ¶
type SchemaNodeConfig struct { Type string `mapstructure:"type"` // "OBJECT|SERVICE" Service string `mapstructure:"service"` ObjectName string `mapstructure:"object_name"` Field string `mapstructure:"field"` Fields []SchemaNodeConfig `mapstructure:"fields"` ExcludeMethods []string `mapstructure:"exclude_methods"` FilterMethods []string `mapstructure:"filter_methods"` }
type SchemaObjects ¶
type SchemaObjects struct { SchemaName string GoPkg string Services []SchemaService QueryObject string MutationObject string Objects []*gqlObject }
type SchemaParserObjects ¶
type SchemaParserObjects struct { Services []SchemaService QueryObject string MutationObject string Objects []*gqlObject }
type SchemaService ¶
type ServiceContext ¶
type ServiceContext struct { Service Service TracerEnabled bool ServiceMethods []Method FieldType string BodyContext BodyContext }
type TypeResolver ¶
type TypeResolver func(ctx BodyContext) string
func GqlListTypeResolver ¶
func GqlListTypeResolver(r TypeResolver) TypeResolver
func GqlNonNullTypeResolver ¶
func GqlNonNullTypeResolver(r TypeResolver) TypeResolver
type TypesFile ¶
type TypesFile struct { PackageName string Package string Enums []Enum OutputObjects []OutputObject InputObjects []InputObject InputObjectResolvers []InputObjectResolver MapInputObjects []MapInputObject MapInputObjectResolvers []MapInputObjectResolver MapOutputObjects []MapOutputObject Services []Service }
type ValueResolver ¶
type ValueResolver func(arg string, ctx BodyContext) string
func IdentAccessValueResolver ¶
func IdentAccessValueResolver(ident string) ValueResolver
func ResolverCall ¶
func ResolverCall(resolverPkg, resolverFuncName string) ValueResolver