Documentation
¶
Index ¶
- Constants
- Variables
- func GetSchema() *introspection.Schema
- func Introspect(ctx context.Context) (*introspection.Schema, error)
- func IntrospectAndGenerate(ctx context.Context, generator Generator) ([]byte, error)
- func SetSchema(schema *introspection.Schema)
- func SetSchemaParents(schema *introspection.Schema)
- type CommonFunctions
- func (c *CommonFunctions) ConvertID(f introspection.Field) bool
- func (c *CommonFunctions) FormatInputType(r *introspection.TypeRef) string
- func (c *CommonFunctions) FormatOutputType(r *introspection.TypeRef) string
- func (c *CommonFunctions) FormatReturnType(f introspection.Field) string
- func (c *CommonFunctions) GetArrayField(f *introspection.Field) []*introspection.Field
- func (c *CommonFunctions) IsListOfObject(t *introspection.TypeRef) bool
- func (c *CommonFunctions) IsSelfChainable(t introspection.Type) bool
- func (c *CommonFunctions) ToLowerCase(s string) string
- func (c *CommonFunctions) ToUpperCase(s string) string
- type Config
- type FormatTypeFuncs
- type Generator
- type SDKLang
Constants ¶
const ( QueryStructName = "Query" QueryStructClientName = "Client" )
Variables ¶
var CustomScalar = map[string]string{
"ContainerID": "Container",
"FileID": "File",
"DirectoryID": "Directory",
"SecretID": "Secret",
"SocketID": "Socket",
"CacheID": "CacheVolume",
"ProjectID": "Project",
"ProjectCommandID": "ProjectCommand",
}
CustomScalar registers custom Dagger type. TODO: This may done it dynamically later instead of a static map.
var ErrUnknownSDKLang = errors.New("unknown sdk language")
Functions ¶
func GetSchema ¶ added in v0.4.2
func GetSchema() *introspection.Schema
func Introspect ¶ added in v0.3.5
func Introspect(ctx context.Context) (*introspection.Schema, error)
Introspect get the Dagger Schema
func IntrospectAndGenerate ¶
IntrospectAndGenerate generate the Dagger API
func SetSchema ¶ added in v0.4.2
func SetSchema(schema *introspection.Schema)
func SetSchemaParents ¶ added in v0.3.5
func SetSchemaParents(schema *introspection.Schema)
SetSchemaParents sets all the parents for the fields.
Types ¶
type CommonFunctions ¶ added in v0.3.12
type CommonFunctions struct {
// contains filtered or unexported fields
}
CommonFunctions formatting function with global shared template functions.
func NewCommonFunctions ¶ added in v0.3.12
func NewCommonFunctions(formatTypeFuncs FormatTypeFuncs) *CommonFunctions
func (*CommonFunctions) ConvertID ¶ added in v0.5.3
func (c *CommonFunctions) ConvertID(f introspection.Field) bool
ConvertID returns true if the field returns an ID that should be converted into an object.
func (*CommonFunctions) FormatInputType ¶ added in v0.3.12
func (c *CommonFunctions) FormatInputType(r *introspection.TypeRef) string
FormatInputType formats a GraphQL type into the SDK language input
Example: `String` -> `string`
func (*CommonFunctions) FormatOutputType ¶ added in v0.3.12
func (c *CommonFunctions) FormatOutputType(r *introspection.TypeRef) string
FormatOutputType formats a GraphQL type into the SDK language output
Example: `String` -> `string`
func (*CommonFunctions) FormatReturnType ¶ added in v0.5.3
func (c *CommonFunctions) FormatReturnType(f introspection.Field) string
FormatReturnType formats a GraphQL type into the SDK language output, unless it's an ID that will be converted which needs to be formatted as an input (for chaining).
func (*CommonFunctions) GetArrayField ¶ added in v0.8.0
func (c *CommonFunctions) GetArrayField(f *introspection.Field) []*introspection.Field
func (*CommonFunctions) IsListOfObject ¶ added in v0.8.0
func (c *CommonFunctions) IsListOfObject(t *introspection.TypeRef) bool
func (*CommonFunctions) IsSelfChainable ¶ added in v0.6.4
func (c *CommonFunctions) IsSelfChainable(t introspection.Type) bool
IsSelfChainable returns true if an object type has any fields that return that same type.
func (*CommonFunctions) ToLowerCase ¶ added in v0.8.0
func (c *CommonFunctions) ToLowerCase(s string) string
func (*CommonFunctions) ToUpperCase ¶ added in v0.8.0
func (c *CommonFunctions) ToUpperCase(s string) string
type FormatTypeFuncs ¶ added in v0.3.12
type FormatTypeFuncs interface { FormatKindList(representation string) string FormatKindScalarString(representation string) string FormatKindScalarInt(representation string) string FormatKindScalarFloat(representation string) string FormatKindScalarBoolean(representation string) string FormatKindScalarDefault(representation string, refName string, input bool) string FormatKindObject(representation string, refName string) string FormatKindInputObject(representation string, refName string) string FormatKindEnum(representation string, refName string) string }
FormatTypeFuncs is an interface to format any GraphQL type. Each generator has to implement this interface.