util

package
v0.0.0-...-5fef39c Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: MIT Imports: 6 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsImmTmpl

func IsImmTmpl(ts *ast.TypeSpec) (string, bool)

IsImmTmpl determines whether the supplied type spec is an immutable template type (either a struct, slice or map), returning the name of the type with the ImmTypeTmplPrefix removed in that case

Types

type ImmType

type ImmType interface {
	// contains filtered or unexported methods
}

func IsImmType

func IsImmType(t types.Type) ImmType

IsImmType determines whether the supplied type is an immutable type. In case a type is immutable, a value of type ImmTypeStruct, ImmTypeSlice or ImmTypeMap is returned. In case the type is immutable but neither of the aforementioned instances, ImmTypeUnknown is returned. If a type is not immutable then nil is returned

type ImmTypeBasic

type ImmTypeBasic struct{}

ImmTypeBasic identifies Go types that are inherently immutable, e.g. ints, strings

type ImmTypeImplsIntf

type ImmTypeImplsIntf struct{}

ImmTypeImplsIntf is used to indicate a type that is not an ImmTypeStruct, ImmTypeMap or ImmTypeSlice, but still satisfies the immutable "interface". See the docs for myitcv.io/immutable.Immutable.

type ImmTypeMap

type ImmTypeMap struct {
	Key  types.Type
	Elem types.Type
}

ImmTypeMap is used to indicate a type that is immutable by virtue of being a pointer to a struct type that was itself generated from an _Imm_ map template.

type ImmTypeSimple

type ImmTypeSimple struct{}

ImmTypeSimple is used to indiciate an interface type that extends the myitcv.io/immutable.Immutable interface.

type ImmTypeSlice

type ImmTypeSlice struct {
	Elem types.Type
}

ImmTypeMap is used to indicate a type that is immutable by virtue of being a pointer to a struct type that was itself generated from an _Imm_ slice template.

type ImmTypeStruct

type ImmTypeStruct struct {
	Struct *types.Struct
}

ImmTypeStruct is used to indicate a type that is immutable by virtue of being a pointer to a struct type that was itself generated from an _Imm_ struct template.

Jump to

Keyboard shortcuts

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