MCPcopy Index your code
hub / github.com/dagger/dagger / getGenerator

Function getGenerator

cmd/codegen/codegen.go:20–39  ·  view source on GitHub ↗
(cfg generator.Config)

Source from the content-addressed store, hash-verified

18type GenFunc func(ctx context.Context, schema *introspection.Schema, schemaVersion string) (*generator.GeneratedState, error)
19
20func getGenerator(cfg generator.Config) (generator.Generator, error) {
21 switch cfg.Lang {
22 case generator.SDKLangGo:
23 return &gogenerator.GoGenerator{
24 Config: cfg,
25 }, nil
26 case generator.SDKLangTypeScript:
27 return &typescriptgenerator.TypeScriptGenerator{
28 Config: cfg,
29 }, nil
30
31 default:
32 sdks := []string{
33 string(generator.SDKLangGo),
34 string(generator.SDKLangTypeScript),
35 }
36
37 return nil, fmt.Errorf("use target SDK language: %s: %w", sdks, generator.ErrUnknownSDKLang)
38 }
39}
40
41func Generate(ctx context.Context, cfg generator.Config, genFunc GenFunc) (err error) {
42 var introspectionSchema *introspection.Schema

Callers 4

GenerateLibraryFunction · 0.85
GenerateTypeDefsFunction · 0.85
GenerateModuleFunction · 0.85
GenerateClientFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected