contractname

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package contractname provides stable ASCII names for generated schema symbols.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Schemas

func Schemas(types []contract.Type, reserved func(string) bool) (map[contract.TypeID]string, error)

Schemas names every schema of one document readably and deterministically. A type's own Go name, including generic arguments (Page_Item for Page[Item]), is used when it is unique in the document and not reserved by the target language. Colliding names are qualified with trailing package path elements (billing.Invoice becomes Billing_Invoice); only a remaining collision uses Symbol's identity digest. Names contain no package path unless they need one, so moving a package keeps its names. A new declaration whose name collides qualifies both names; clients that must be immune to that can select types by identity through the generated ContractTypes index.

func Symbol

func Symbol(identity string) string

Symbol is a stable digest-qualified name for one identity. It never depends on other declarations; use it where names must survive additions.

Types

This section is empty.

Jump to

Keyboard shortcuts

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