Documentation
¶
Overview ¶
Package types contains utils to work with types.
Index ¶
- func FindExternalTypes(pkgsTypes slices.Sorted[*Type], taggedStructs ast.TaggedStructs) slices.Sorted[ExternalType]
- func FindPkgDecls(taggedStructs ast.TaggedStructs, loadedPkgs []*packages.Package) (slices.Sorted[*PkgDecl], error)
- func MatchTypeData[T Basic | Complex | Map | Slice](d TypeInfoData) (T, bool)
- func ParseDeclsData(sortedPkgs slices.Sorted[*PkgDecl], taggedStructs ast.TaggedStructs) (slices.Sorted[*Type], error)
- type Basic
- type Complex
- type ExternalType
- type FieldData
- type Map
- type PkgDecl
- type Slice
- type Type
- type TypeInfoData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindExternalTypes ¶
func FindExternalTypes(pkgsTypes slices.Sorted[*Type], taggedStructs ast.TaggedStructs) slices.Sorted[ExternalType]
FindExternalTypes finds all external types in the given list of types.
func FindPkgDecls ¶
func FindPkgDecls(taggedStructs ast.TaggedStructs, loadedPkgs []*packages.Package) (slices.Sorted[*PkgDecl], error)
FindPkgDecls finds all declarations in the given packages.
func MatchTypeData ¶
MatchTypeData matches the given TypeInfoData to the given type.
Types ¶
type ExternalType ¶
ExternalType is a struct which contains external type pkg and name.
func (ExternalType) String ¶
func (e ExternalType) String() string
String returns a string representation of the ExternalType.
type PkgDecl ¶
type PkgDecl struct {
// contains filtered or unexported fields
}
PkgDecl is a struct which contains package path and tagged struct declarations.
type Type ¶
type Type struct {
Pkg string
Name string
Comments []string
// contains filtered or unexported fields
}
Type is a struct which contains type pkg, name, comments and fields.
type TypeInfoData ¶
type TypeInfoData struct {
// contains filtered or unexported fields
}
TypeInfoData is a struct which contains type data.
func MakeTypeData ¶
func MakeTypeData[T Basic | Complex | Map | Slice](v T) TypeInfoData
MakeTypeData creates a new TypeInfoData from the given type.
func TypeInfo ¶
func TypeInfo(t types.Type) TypeInfoData
TypeInfo extracts all type data from the given type.