Documentation ¶
Index ¶
- Variables
- func Execute()
- func FieldCommandArgName(f FieldCommandArgument) string
- func FieldCommandArgType(f FieldCommandArgument) string
- func NewCompletionCommand(config CompletionCommandConfig) *cobra.Command
- func NewFieldsCommand(schema introspection.Schema) *cobra.Command
- func NewRawCommand(config RawCommandConfig) *cobra.Command
- func NewRootCommand(args []string) *cobra.Command
- func Peek(cargs []string, endpoint *string, header Header, flagset *pflag.FlagSet) []string
- func Set(cmd *cobra.Command, f FieldCommandArgument)
- type ArgsCommandConfig
- type ArgsSchema
- type Command
- type CommandBuilder
- type CommandBuilderFunc
- type CompletionCommandConfig
- type Config
- type FieldCommand
- type FieldCommandArgument
- type FieldCommandBooleanArgument
- type FieldCommandCustomScalarArgument
- type FieldCommandEnumArgument
- type FieldCommandFloatArgument
- type FieldCommandIDArgument
- type FieldCommandInputArgument
- type FieldCommandIntArgument
- type FieldCommandListArgument
- type FieldCommandNonNullArgument
- type FieldCommandStringArgument
- type FieldCommandValue
- type GraphQLCommand
- type GraphQLCommandConfig
- type GraphQLCommandType
- type GraphQLRootCommands
- type GraphQLRootConfig
- type GraphQLTypeCommandMap
- type Header
- type IntrospectionCommand
- type IntrospectionCommandConfig
- type QueryBuilder
- type RawCommandConfig
- type Setter
- type Variables
Constants ¶
This section is empty.
Variables ¶
View Source
var (
CacheTimeout time.Duration = -10 * time.Minute
)
Functions ¶
func Execute ¶
func Execute()
Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func FieldCommandArgName ¶
func FieldCommandArgName(f FieldCommandArgument) string
func FieldCommandArgType ¶
func FieldCommandArgType(f FieldCommandArgument) string
func NewCompletionCommand ¶
func NewCompletionCommand(config CompletionCommandConfig) *cobra.Command
func NewFieldsCommand ¶
func NewFieldsCommand(schema introspection.Schema) *cobra.Command
fieldsCmd represents the fields command
func NewRawCommand ¶
func NewRawCommand(config RawCommandConfig) *cobra.Command
rawCmd represents the raw command
func NewRootCommand ¶
NewRootCommand creates root command a base command for gql
func Set ¶
func Set(cmd *cobra.Command, f FieldCommandArgument)
Types ¶
type ArgsCommandConfig ¶
type ArgsCommandConfig struct { Config Schema ArgsSchema }
type ArgsSchema ¶
type ArgsSchema interface { // FieldForPath returns field for object for path, or false // if not found FieldForPath([]string) (introspection.Field, bool) }
ArgsSchema defines interface that must be implemented by schema for args command
type Command ¶
func NewArgsCommand ¶
func NewArgsCommand(config ArgsCommandConfig) *Command
argsCmd represents the args command
type CommandBuilder ¶
type CommandBuilderFunc ¶
type CompletionCommandConfig ¶
type CompletionCommandConfig struct { Config CommandBuilder }
type FieldCommand ¶
type FieldCommand struct { *cobra.Command Field introspection.Field Schema introspection.Schema Args []FieldCommandArgument MaxDepth int Fields []string }
func NewFieldCommand ¶
func NewFieldCommand( field introspection.Field, schema introspection.Schema, RunE func(*cobra.Command, []string) error, PreRun func(*cobra.Command, []string), ) *FieldCommand
func (*FieldCommand) ArgsString ¶
func (f *FieldCommand) ArgsString() string
func (*FieldCommand) BuildQuery ¶
func (f *FieldCommand) BuildQuery() string
type FieldCommandArgument ¶
type FieldCommandArgument interface { FieldCommandValue // argument value Value() interface{} // argument name Name() string }
func GetFieldArguments ¶
func GetFieldArguments(field introspection.Field) []FieldCommandArgument
type FieldCommandBooleanArgument ¶
type FieldCommandBooleanArgument struct {
// contains filtered or unexported fields
}
func (*FieldCommandBooleanArgument) Name ¶
func (f *FieldCommandBooleanArgument) Name() string
func (*FieldCommandBooleanArgument) String ¶
func (f *FieldCommandBooleanArgument) String() string
func (*FieldCommandBooleanArgument) Type ¶
func (f *FieldCommandBooleanArgument) Type() string
func (*FieldCommandBooleanArgument) Value ¶
func (f *FieldCommandBooleanArgument) Value() interface{}
type FieldCommandCustomScalarArgument ¶
type FieldCommandCustomScalarArgument struct {
// contains filtered or unexported fields
}
func (*FieldCommandCustomScalarArgument) Name ¶
func (f *FieldCommandCustomScalarArgument) Name() string
func (*FieldCommandCustomScalarArgument) String ¶
func (f *FieldCommandCustomScalarArgument) String() string
func (*FieldCommandCustomScalarArgument) Type ¶
func (f *FieldCommandCustomScalarArgument) Type() string
func (*FieldCommandCustomScalarArgument) Value ¶
func (f *FieldCommandCustomScalarArgument) Value() interface{}
type FieldCommandEnumArgument ¶
type FieldCommandEnumArgument struct {
// contains filtered or unexported fields
}
func (*FieldCommandEnumArgument) Name ¶
func (f *FieldCommandEnumArgument) Name() string
func (*FieldCommandEnumArgument) String ¶
func (f *FieldCommandEnumArgument) String() string
func (*FieldCommandEnumArgument) Type ¶
func (f *FieldCommandEnumArgument) Type() string
func (*FieldCommandEnumArgument) Value ¶
func (f *FieldCommandEnumArgument) Value() interface{}
type FieldCommandFloatArgument ¶
type FieldCommandFloatArgument struct {
// contains filtered or unexported fields
}
func (*FieldCommandFloatArgument) Name ¶
func (f *FieldCommandFloatArgument) Name() string
func (*FieldCommandFloatArgument) String ¶
func (f *FieldCommandFloatArgument) String() string
func (*FieldCommandFloatArgument) Type ¶
func (f *FieldCommandFloatArgument) Type() string
func (*FieldCommandFloatArgument) Value ¶
func (f *FieldCommandFloatArgument) Value() interface{}
type FieldCommandIDArgument ¶
type FieldCommandIDArgument struct {
// contains filtered or unexported fields
}
func (*FieldCommandIDArgument) Name ¶
func (f *FieldCommandIDArgument) Name() string
func (*FieldCommandIDArgument) String ¶
func (f *FieldCommandIDArgument) String() string
func (*FieldCommandIDArgument) Type ¶
func (f *FieldCommandIDArgument) Type() string
func (*FieldCommandIDArgument) Value ¶
func (f *FieldCommandIDArgument) Value() interface{}
type FieldCommandInputArgument ¶
type FieldCommandInputArgument struct {
// contains filtered or unexported fields
}
func (*FieldCommandInputArgument) Name ¶
func (f *FieldCommandInputArgument) Name() string
func (*FieldCommandInputArgument) String ¶
func (f *FieldCommandInputArgument) String() string
func (*FieldCommandInputArgument) Type ¶
func (f *FieldCommandInputArgument) Type() string
func (*FieldCommandInputArgument) Value ¶
func (f *FieldCommandInputArgument) Value() interface{}
type FieldCommandIntArgument ¶
type FieldCommandIntArgument struct {
// contains filtered or unexported fields
}
represnets GraphQL field argument of type Int
func (*FieldCommandIntArgument) Name ¶
func (f *FieldCommandIntArgument) Name() string
func (*FieldCommandIntArgument) String ¶
func (f *FieldCommandIntArgument) String() string
func (*FieldCommandIntArgument) Type ¶
func (f *FieldCommandIntArgument) Type() string
func (*FieldCommandIntArgument) Value ¶
func (f *FieldCommandIntArgument) Value() interface{}
type FieldCommandListArgument ¶
type FieldCommandListArgument struct { FieldCommandArgument // contains filtered or unexported fields }
func (*FieldCommandListArgument) String ¶
func (f *FieldCommandListArgument) String() string
func (*FieldCommandListArgument) Type ¶
func (f *FieldCommandListArgument) Type() string
func (*FieldCommandListArgument) Value ¶
func (f *FieldCommandListArgument) Value() interface{}
type FieldCommandNonNullArgument ¶
type FieldCommandNonNullArgument struct {
FieldCommandArgument
}
func (*FieldCommandNonNullArgument) Type ¶
func (f *FieldCommandNonNullArgument) Type() string
func (*FieldCommandNonNullArgument) Value ¶
func (f *FieldCommandNonNullArgument) Value() interface{}
type FieldCommandStringArgument ¶
type FieldCommandStringArgument struct {
// contains filtered or unexported fields
}
func (*FieldCommandStringArgument) Name ¶
func (f *FieldCommandStringArgument) Name() string
func (*FieldCommandStringArgument) String ¶
func (f *FieldCommandStringArgument) String() string
func (*FieldCommandStringArgument) Type ¶
func (f *FieldCommandStringArgument) Type() string
func (*FieldCommandStringArgument) Value ¶
func (f *FieldCommandStringArgument) Value() interface{}
type FieldCommandValue ¶
type GraphQLCommand ¶
type GraphQLCommand struct { Config GraphQLCommandConfig FieldCommand *FieldCommand QueryBuilder *QueryBuilder }
func NewGraphQLCommand ¶
func NewGraphQLCommand(config GraphQLCommandConfig) GraphQLCommand
func (*GraphQLCommand) BuildSubCommands ¶
func (g *GraphQLCommand) BuildSubCommands() error
func (*GraphQLCommand) FieldPreRun ¶
func (g *GraphQLCommand) FieldPreRun(c *cobra.Command, args []string)
appends field query parent to a query
type GraphQLCommandConfig ¶
type GraphQLCommandConfig struct { Config // requied: name of the field this command resolves Field introspection.Field // required: query builder QueryBuilder *QueryBuilder // optional: path requested from this field Path []string // required: schema executed by command Schema introspection.Schema }
type GraphQLCommandType ¶
type GraphQLCommandType struct { Description string Fields map[string]*FieldCommand }
type GraphQLRootCommands ¶
type GraphQLRootCommands struct { Config GraphQLRootConfig Query GraphQLCommand Mutation GraphQLCommand Subscription GraphQLCommand Schema introspection.Schema QueryBuilder *QueryBuilder }
func DefaultRootCommands ¶
func DefaultRootCommands() GraphQLRootCommands
func NewGraphQLRootCommands ¶
func NewGraphQLRootCommands(config GraphQLRootConfig) (GraphQLRootCommands, error)
type GraphQLRootConfig ¶
type GraphQLRootConfig struct { Config // required: remote graphql endpoint Endpoint string // any additional headers that should // be attached to the request Header Header // ignore local schema data and use upstream // endpoint, optional ForceRemote bool // optional: query builder used by command QueryBuilder *QueryBuilder // required: path being resolved by a command Path []string // optional: local schema Schema *graphql.Schema }
all commands on graphql start here
type GraphQLTypeCommandMap ¶
type GraphQLTypeCommandMap map[string]GraphQLCommandType
type IntrospectionCommand ¶
type IntrospectionCommand struct { *cobra.Command GraphQLRootCommands Config IntrospectionCommandConfig }
func NewIntrospectionCommand ¶
func NewIntrospectionCommand(config IntrospectionCommandConfig) IntrospectionCommand
type QueryBuilder ¶
type QueryBuilder struct {
// contains filtered or unexported fields
}
func (*QueryBuilder) Query ¶
func (qb *QueryBuilder) Query() string
func (*QueryBuilder) Set ¶
func (qb *QueryBuilder) Set(name string, value interface{})
func (*QueryBuilder) Variables ¶
func (qb *QueryBuilder) Variables() map[string]interface{}
func (*QueryBuilder) Wrap ¶
func (qb *QueryBuilder) Wrap(name string, extra ...string)
type RawCommandConfig ¶
type RawCommandConfig struct {
Config
}
type Setter ¶
type Setter interface {
Set(*cobra.Command, FieldCommandArgument)
}
Click to show internal directories.
Click to hide internal directories.