model

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: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeDAMLType

func NormalizeDAMLType(damlType string) string

Types

type Any

type Any struct {
	// contains filtered or unexported fields
}

func (Any) GoImport

func (Any) GoImport() *ExternalPackage

func (Any) GoType

func (t Any) GoType() string

type BigNumeric

type BigNumeric struct {
	// contains filtered or unexported fields
}

func (BigNumeric) GoImport

func (BigNumeric) GoImport() *ExternalPackage

func (BigNumeric) GoType

func (t BigNumeric) GoType() string

type Bool

type Bool struct {
	// contains filtered or unexported fields
}

func (Bool) GoImport

func (Bool) GoImport() *ExternalPackage

func (Bool) GoType

func (t Bool) GoType() string

type BytesHex

type BytesHex struct {
	// contains filtered or unexported fields
}

func (BytesHex) GoImport

func (BytesHex) GoImport() *ExternalPackage

func (BytesHex) GoType

func (t BytesHex) GoType() string

func (BytesHex) IsBytesHex

func (t BytesHex) IsBytesHex() bool

IsBytesHex returns true - used by template to add hex:"bytes16" tag

type ContractId

type ContractId struct {
	// contains filtered or unexported fields
}

func (ContractId) GoImport

func (ContractId) GoImport() *ExternalPackage

func (ContractId) GoType

func (t ContractId) GoType() string

type DamlType

type DamlType interface {
	GoType() string
	GoImport() *ExternalPackage
}

type Date

type Date struct {
	// contains filtered or unexported fields
}

func (Date) GoImport

func (Date) GoImport() *ExternalPackage

func (Date) GoType

func (t Date) GoType() string

type Decimal

type Decimal struct {
	// contains filtered or unexported fields
}

func (Decimal) GoImport

func (Decimal) GoImport() *ExternalPackage

func (Decimal) GoType

func (t Decimal) GoType() string

type Enum

type Enum struct {
	// contains filtered or unexported fields
}

func (Enum) GoImport

func (Enum) GoImport() *ExternalPackage

func (Enum) GoType

func (t Enum) GoType() string

type ExternalPackage

type ExternalPackage struct {
	// The import to use to refer to this package, e.g. github.com/smartcontractkit/go-daml/etc
	Import string
	// The alias to import this package by
	Alias string
}

type ExternalPackages

type ExternalPackages struct {
	// Maps packageId => package
	Packages map[string]ExternalPackage
}

type FieldHints

type FieldHints struct {
	// BytesFields: field names that should receive a hex:"bytes" tag (uint8 length prefix, ≤255 bytes).
	BytesFields map[string]bool
	// BytesHexFields: field names that should receive a hex:"bytes16" tag (uint16 length prefix).
	BytesHexFields map[string]bool
	// Uint32Fields: field names where INT64 should be encoded as a 4-byte uint32 (hex:"uint32" tag).
	Uint32Fields map[string]bool
	// Uint32ListFields: field names where []INT64 should be encoded as []uint32 (hex:"[]uint32" tag).
	Uint32ListFields map[string]bool
	// VariantTagByteMap: maps fully-qualified variant type name (e.g. "Module.TypeName") to
	// a map of constructor names to their numeric tag bytes for MCMS encoding.
	// Example: {"MyModule.TransferTimeout": {"Indefinite": 0x00, "RelativeHours": 0x01}}
	VariantTagByteMap map[string]map[string]byte
}

FieldHints allows callers to declare which struct field names need non-default hex encoding tags. Because the Daml compiler erases type synonyms (e.g. BytesHex becomes Text in the compiled Daml-LF), go-daml cannot infer the correct encoding from the .dalf alone. Callers that know the encoding semantics of their contracts populate these maps and pass a FieldHints value to CodegenDalfs / GetAST.

An empty (zero-value) FieldHints is valid and means no special encoding is applied.

type GenMap

type GenMap struct {
	// contains filtered or unexported fields
}

func (GenMap) GoImport

func (GenMap) GoImport() *ExternalPackage

func (GenMap) GoType

func (t GenMap) GoType() string

type Imported

type Imported struct {
	Underlying      DamlType
	ExternalPackage ExternalPackage
}

func (Imported) GoImport

func (t Imported) GoImport() *ExternalPackage

func (Imported) GoType

func (t Imported) GoType() string

type Int64

type Int64 struct {
	// contains filtered or unexported fields
}

func (Int64) GoImport

func (Int64) GoImport() *ExternalPackage

func (Int64) GoType

func (t Int64) GoType() string

type InterfaceMap

type InterfaceMap map[string]*TmplStruct

type List

type List struct {
	Inner DamlType
}

func (List) GoImport

func (t List) GoImport() *ExternalPackage

func (List) GoType

func (t List) GoType() string

type Manifest

type Manifest struct {
	Version    string
	CreatedBy  string
	Name       string
	SdkVersion string
	MainDalf   string
	Dalfs      []string
	Format     string
	Encryption string
}

type Map

type Map struct {
	// contains filtered or unexported fields
}

func (Map) GoImport

func (Map) GoImport() *ExternalPackage

func (Map) GoType

func (t Map) GoType() string

type Metadata

type Metadata struct {
	Name         string
	Version      string
	Dependencies []string
	LangVersion  string
	CreatedBy    string
	SdkVersion   string
	CreatedAt    *time.Time
}

type Numeric

type Numeric struct {
	// contains filtered or unexported fields
}

func (Numeric) GoImport

func (Numeric) GoImport() *ExternalPackage

func (Numeric) GoType

func (t Numeric) GoType() string

type Optional

type Optional struct {
	Inner DamlType
}

func (Optional) GoImport

func (t Optional) GoImport() *ExternalPackage

func (Optional) GoType

func (t Optional) GoType() string

type Package

type Package struct {
	Name             string
	Version          string
	PackageID        string
	Structs          map[string]*TmplStruct
	Metadata         *Metadata
	ImportedPackages []ExternalPackage
}

type Party

type Party struct {
	// contains filtered or unexported fields
}

func (Party) GoImport

func (Party) GoImport() *ExternalPackage

func (Party) GoType

func (t Party) GoType() string

type RelTime

type RelTime struct {
	// contains filtered or unexported fields
}

func (RelTime) GoImport

func (RelTime) GoImport() *ExternalPackage

func (RelTime) GoType

func (t RelTime) GoType() string

type RoundingMode

type RoundingMode struct {
	// contains filtered or unexported fields
}

func (RoundingMode) GoImport

func (RoundingMode) GoImport() *ExternalPackage

func (RoundingMode) GoType

func (t RoundingMode) GoType() string

type Set

type Set struct {
	// contains filtered or unexported fields
}

func (Set) GoImport

func (Set) GoImport() *ExternalPackage

func (Set) GoType

func (t Set) GoType() string

type Text

type Text struct {
	// contains filtered or unexported fields
}

func (Text) GoImport

func (Text) GoImport() *ExternalPackage

func (Text) GoType

func (t Text) GoType() string

type TextMap

type TextMap struct {
	// contains filtered or unexported fields
}

func (TextMap) GoImport

func (TextMap) GoImport() *ExternalPackage

func (TextMap) GoType

func (t TextMap) GoType() string

type Timestamp

type Timestamp struct {
	// contains filtered or unexported fields
}

func (Timestamp) GoImport

func (Timestamp) GoImport() *ExternalPackage

func (Timestamp) GoType

func (t Timestamp) GoType() string

type TmplChoice

type TmplChoice struct {
	Name    string
	ArgType DamlType
	// ReturnType        DamlType // Not used for now
	Interface         DamlType // If this choice is implementing an interface
	InterfaceName     string   // The Go name of the interface this choice comes from (e.g., "ITransferable")
	InterfaceDAMLName string   // The original DAML name of the interface (e.g., "Transferable")
}

type TmplField

type TmplField struct {
	Type         DamlType
	Name         string
	RawType      string
	IsOptional   bool
	IsEnum       bool
	IsBytes      bool // True if field should use uint8 length prefix (hex:"bytes" tag)
	IsBytesHex   bool // True if field should use uint16 length prefix (hex:"bytes16" tag)
	IsUint32     bool // True if INT64 field should encode as 4-byte uint32 (hex:"uint32" tag)
	IsUint32List bool // True if []INT64 field should encode with 4-byte uint32 elements (hex:"[]uint32" tag)
}

type TmplStruct

type TmplStruct struct {
	Name        string
	DAMLName    string
	ModuleName  string
	Fields      []*TmplField
	RawType     string
	IsTemplate  bool
	IsInterface bool
	Key         *TmplField
	Choices     []*TmplChoice
	Implements  []DamlType // Set if this struct implements any interfaces
	Signatories []string
	Observers   []string
	Location    string
	// VariantTagMapping maps variant field names to their numeric tag bytes for MCMS encoding.
	// When set, codegen generates GetVariantTagByte() method implementing VariantWithTagByte interface.
	VariantTagMapping map[string]byte
}

type Unit

type Unit struct {
	// contains filtered or unexported fields
}

func (Unit) GoImport

func (Unit) GoImport() *ExternalPackage

func (Unit) GoType

func (t Unit) GoType() string

type Unknown

type Unknown struct {
	String string
	// contains filtered or unexported fields
}

func (Unknown) GoImport

func (Unknown) GoImport() *ExternalPackage

func (Unknown) GoType

func (t Unknown) GoType() string

Jump to

Keyboard shortcuts

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