Documentation
¶
Overview ¶
Package damltemplate generates Daml codec source code from parsed type definitions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Generate ¶
func Generate(module *damlparser.ParsedModule, config DamlCodecConfig) (string, error)
Generate produces Daml codec source code.
Types ¶
type CustomCodec ¶
type CustomCodec struct {
EncodeFunc string // e.g., "encodeRawInstanceAddress"
DecodeFunc string // e.g., "decodeRawInstanceAddressAt"
ImportModule string // e.g., "MyModule.Codec"
// For list types
EncodeListFunc string // e.g., "encodeRawInstanceAddressList" (optional)
DecodeListFunc string // e.g., "decodeRawInstanceAddressList" (optional)
}
CustomCodec defines encode/decode functions for a custom type.
type DamlCodecConfig ¶
type DamlCodecConfig struct {
// ModuleName is the output module name (e.g., "MyModule.Codec")
ModuleName string
// TypesModule is the module containing the type definitions (e.g., "MyModule.Types")
TypesModule string
// CustomTypeCodecs maps type names to their custom codec functions
CustomTypeCodecs map[string]CustomCodec
// VariantTagByteMap maps variant type names to constructor->tag byte mappings
VariantTagByteMap map[string]map[string]int
// TargetTypes is the list of types to generate codecs for (empty = all)
TargetTypes []string
}
DamlCodecConfig configures the Daml codec generator.
Click to show internal directories.
Click to hide internal directories.