util

package
v0.0.0-...-389821e Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2018 License: BSD-3-Clause, BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsImmTmplAst

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

IsImmTmplAst 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 ImmTypeAst

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

func IsImmTypeAst

func IsImmTypeAst(ts ast.Expr, imps []*ast.ImportSpec, pkg string) (ImmTypeAst, error)

IsImmTypeAst determines by syntax tree analysis alone whether the supplied ast.Expr represents an immutable type. In case a type is immutable, a value of type ImmTypeAstStruct, ImmTypeAstSlice or ImmTypeAstMap. In case the type is "implements" the full immutable "interface" but neither of the aforementioned instances, ImmTypeAstImplsInt is returned. For special types like time.Time, ImmTypeAstSpecial is returned. For basic types, ImmTypeAstBasic is returned. If a type is a reference to an interface type that extends immutable.Immutable then ImmTypeAstExtIntf is returned. If a type is not immutable then nil is returned. For now this is not thread safe....

type ImmTypeAstBasic

type ImmTypeAstBasic struct{}

type ImmTypeAstExtIntf

type ImmTypeAstExtIntf struct{}

type ImmTypeAstImplsIntf

type ImmTypeAstImplsIntf struct{}

type ImmTypeAstMap

type ImmTypeAstMap struct {
	Key  ast.Expr
	Elem ast.Expr
}

type ImmTypeAstSlice

type ImmTypeAstSlice struct {
	Elem ast.Expr
}

type ImmTypeAstSpecial

type ImmTypeAstSpecial struct{}

type ImmTypeAstStruct

type ImmTypeAstStruct struct{}

type ImmTypeMap

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

type ImmTypeSlice

type ImmTypeSlice struct {
	Elem types.Type
}

type ImmTypeStruct

type ImmTypeStruct struct{}

type ImmTypeUnknown

type ImmTypeUnknown struct{}

Jump to

Keyboard shortcuts

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