structure

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package structure defines a simplified structure representation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(dir string) ([]*packages.Package, error)

Load loads Go packages from the given directory, test packages are excluded.

Types

type FieldBase

type FieldBase struct {
	Index      uint64 // Field position in the structure.
	Name       string
	Tag        reflect.StructTag
	IsEmbedded bool
	Doc        string
}

FieldBase contains basic data shared by all structure fields.

type ScalarField

type ScalarField struct {
	FieldBase
	ScalarType
}

ScalarField represents a field with a non-structure type.

type ScalarType

type ScalarType struct {
	TypeBase
	ImplementsStringParser bool
	ImplementsConfigLoader bool
}

ScalarType represents the type information of a non-structure field.

type StructField

type StructField struct {
	FieldBase
	StructType
}

StructField represents a field with a nested structure type.

type StructFields

type StructFields struct {
	ScalarFields      []ScalarField
	StructFields      []StructField
	ScalarSliceFields []ScalarField
	StructSliceFields []StructField
}

StructFields groups fields in a structure by their type.

type StructType

type StructType struct {
	TypeBase
	Fields StructFields
}

StructType represents the type information of a structure field.

func New

func New(typeName string, pkgs []*packages.Package) (*StructType, *packages.Package, error)

New returns a simplified representation of the structure type.

type TypeBase

type TypeBase struct {
	PkgPath  string
	PkgName  string
	TypeName string
	Doc      string
}

TypeBase contains basic data shared by all field types.

Jump to

Keyboard shortcuts

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