damltemplate

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

Jump to

Keyboard shortcuts

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