Help us shape the future of Go! Take the 2026 Go Developer Survey

register

package
v2.950.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Register

type Register struct {
	// types in the type register are generally considered immutable.
	Types                *sequencedmap.Map[string, *ast.TypeDef]
	TypesUsedInWeakUnion map[string]*ast.TypeDef

	Config *configuration.Config
	// contains filtered or unexported fields
}

Register

The type register ensures that we have a minimal set of types needed in our SDKs It helps recognize when we can, and when we cannot de-duplicate types. The primary method is just:

RegisterType(ctx, typeDef, isInputType)

This register a given typeDef. It might return a different typeDef if it determines it is appropriate.

Extra methods to handle some special cases: in particular some types are expected to be *mutated*

func New

func New() *Register

func (*Register) AllTypes

func (r *Register) AllTypes() ast.TypeDefs

func (*Register) CloseType

func (r *Register) CloseType(typeDef *ast.TypeDef)

func (*Register) CloseTypes

func (r *Register) CloseTypes(resp *ast.Response) error

func (*Register) IsTypeRegistered

func (r *Register) IsTypeRegistered(typedef *ast.TypeDef) bool

func (*Register) RegisterType

func (r *Register) RegisterType(ctx context.Context, typeDef *ast.TypeDef, isInputType bool) *ast.TypeDef

RegisterType registers a type based on its name and context.

func (*Register) RegisterTypeUsedInWeakUnion

func (r *Register) RegisterTypeUsedInWeakUnion(typeDef *ast.TypeDef)

Notice: this won't differentiate between types with the same name in different contexts, is that a problem?

func (*Register) UnregisterOrCloneTypeInPreparationForCreatingErrorType

func (r *Register) UnregisterOrCloneTypeInPreparationForCreatingErrorType(ctx context.Context, typ *ast.TypeDef) *ast.TypeDef

func (*Register) UnregisterType

func (r *Register) UnregisterType(typeDef *ast.TypeDef)

func (*Register) UpdateRegisteredTypeToErrorsScopeLegacy deprecated

func (r *Register) UpdateRegisteredTypeToErrorsScopeLegacy(ctx context.Context, typ *ast.TypeDef, isRootType bool) *ast.TypeDef

Deprecated: use g.subsystem.Config.Generation.Fixes.SharedErrorComponentsApr2025

Jump to

Keyboard shortcuts

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