types

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddIndent

func AddIndent(code string, numOfIndentations int) string

AddIndent adds indentation to the code.

func Var

func Var(prefix string, varIndex *uint64) string

Var generates unique variable name with provided prefix.

Types

type BuilderFactory

type BuilderFactory interface {
	Dependencies() []reflect.Type
	ConstantSize() uint64
	SizeCodeTemplate(varIndex *uint64) (string, bool)
	MarshalCodeTemplate(varIndex *uint64) string
	UnmarshalCodeTemplate(varIndex *uint64) string
}

BuilderFactory is the interface every type builder must implement.

type BuilderFactoryConstant

type BuilderFactoryConstant interface {
	Dependencies() []reflect.Type
	ConstantSize() uint64
	MarshalCodeTemplate(varIndex *uint64) string
	UnmarshalCodeTemplate(varIndex *uint64) string
}

BuilderFactoryConstant is the relaxed interface implemented by builders representing types requiring only constant size of buffer.

type BuilderFactoryNonConstant

type BuilderFactoryNonConstant interface {
	Dependencies() []reflect.Type
	SizeCodeTemplate(varIndex *uint64) string
	MarshalCodeTemplate(varIndex *uint64) string
	UnmarshalCodeTemplate(varIndex *uint64) string
}

BuilderFactoryNonConstant is the relaxed interface implemented by builders representing types requiring only non-constant size of buffer.

type TypeMap

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

TypeMap implements type mapping required by go code.

func NewTypeMap

func NewTypeMap(pkg string) *TypeMap

NewTypeMap creates new type map.

func (*TypeMap) Import

func (tm *TypeMap) Import(pkg string) string

Import adds package to the list of imports.

func (*TypeMap) Imports

func (tm *TypeMap) Imports() map[string]string

Imports returns the list of collected imports.

func (*TypeMap) TypeName

func (tm *TypeMap) TypeName(t reflect.Type) string

TypeName generates a type name for type.

func (*TypeMap) VarName added in v0.7.0

func (tm *TypeMap) VarName(t reflect.Type, prefix string) string

VarName generates deterministic variable name based on its type.

Jump to

Keyboard shortcuts

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