templates

package
v1.0.0-beta.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Go name linting. Copied from https://github.com/golang/lint/blob/master/lint.go#L719

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectionPragma

func CollectionPragma(doc string) (bool, error)

CollectionPragma is shared with the runtime build's private-state pass.

func DepAliasTemplate

func DepAliasTemplate(funcs template.FuncMap) (*template.Template, error)

DepAliasTemplate returns the template used to re-export, back into package dagger, any brand new types a dependency contributes (as opposed to methods it adds to existing core types, which stay in internal/dagger/core alongside their real declarations — see _dep.gen.go.tmpl). Like DepTemplate, its output file name is dynamic and so it is excluded from Templates().

func DepTemplate added in v0.20.4

func DepTemplate(funcs template.FuncMap) (*template.Template, error)

DepTemplate returns the template used to render a per-dependency generated file (internal/dagger/_dep.gen.go.tmpl), bound to the provided FuncMap. This template is intentionally excluded from the auto-generated targets returned by Templates() because the output file name is dynamic (derived from the dependency name).

func GoTemplateFuncs

func GoTemplateFuncs(
	ctx context.Context,
	schema *introspection.Schema,
	fullSchema *introspection.Schema,
	schemaVersion string,
	cfg generator.Config,
	pkg *packages.Package,
	fset *token.FileSet,
	pass int,
) template.FuncMap

func ModuleRelPath

func ModuleRelPath(cfg generator.Config, fileDir string) func(string) string

ModuleRelPath returns the ModuleRelPath template function for a file generated into fileDir, a directory relative to the module root. Source map paths are relative to the module's context directory, so the result climbs out of fileDir, then from the module root to the context directory.

func Templates added in v0.9.6

func Templates(funcs template.FuncMap) map[string]*template.Template

Templates returns a map from output file path to a ready-to-execute template, one entry per non-"_"-prefixed file under src/. It is safe to call multiple times with different FuncMaps (e.g. for core schema vs per-dep schemas).

Types

type FormatTypeFunc

type FormatTypeFunc struct {
	// contains filtered or unexported fields
}

FormatTypeFunc is an implementation of generator.FormatTypeFuncs interface to format GraphQL type into Golang.

func (*FormatTypeFunc) FormatKindEnum

func (f *FormatTypeFunc) FormatKindEnum(representation string, refName string) string

func (*FormatTypeFunc) FormatKindInputObject

func (f *FormatTypeFunc) FormatKindInputObject(representation string, refName string, input bool) string

func (*FormatTypeFunc) FormatKindList

func (f *FormatTypeFunc) FormatKindList(representation string) string

func (*FormatTypeFunc) FormatKindObject

func (f *FormatTypeFunc) FormatKindObject(representation string, refName string, input bool) string

func (*FormatTypeFunc) FormatKindScalarBoolean

func (f *FormatTypeFunc) FormatKindScalarBoolean(representation string) string

func (*FormatTypeFunc) FormatKindScalarDefault

func (f *FormatTypeFunc) FormatKindScalarDefault(representation string, refName string, input bool) string

func (*FormatTypeFunc) FormatKindScalarFloat

func (f *FormatTypeFunc) FormatKindScalarFloat(representation string) string

func (*FormatTypeFunc) FormatKindScalarInt

func (f *FormatTypeFunc) FormatKindScalarInt(representation string) string

func (*FormatTypeFunc) FormatKindScalarString

func (f *FormatTypeFunc) FormatKindScalarString(representation string) string

func (*FormatTypeFunc) WithScope added in v0.9.6

func (f *FormatTypeFunc) WithScope(scope string) generator.FormatTypeFuncs

type ModuleIntrospectionEmitter

type ModuleIntrospectionEmitter interface {
	ModuleIntrospectionJSON(moduleName string) ([]byte, error)
}

ModuleIntrospectionEmitter produces the module's own types as introspection JSON, for merging into the dependency schema.

func NewModuleIntrospectionEmitter

func NewModuleIntrospectionEmitter(
	ctx context.Context,
	schema *introspection.Schema,
	schemaVersion string,
	cfg generator.Config,
	pkg *packages.Package,
	fset *token.FileSet,
) ModuleIntrospectionEmitter

NewModuleIntrospectionEmitter constructs a minimal emitter suitable for calling ModuleIntrospectionJSON. The schema and schemaVersion are the current (deps) schema; pkg and fset are from packages.Load on the module source.

type NamedParsedType added in v0.9.6

type NamedParsedType interface {
	ParsedType
	Name() string
	ModuleName() string
}

type ParsedType added in v0.9.5

type ParsedType interface {
	// Generated code for registering the type with the dagger API
	TypeDefCode() (*Statement, error)

	// The underlying go type that ParsedType wraps
	GoType() types.Type

	// Go types referred to by this type
	GoSubTypes() []types.Type
}

A Go type that has been parsed and can be registered with the dagger API

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL