source

package
v1.0.8-beta.11 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package source contains functions for parsing Go source files.

This package is used for extract information about structures and their fields from Go source files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldInfo

type FieldInfo struct {
	// Field type name.
	Type string
	// Equals true if field is a pointer.
	IsPointer bool
}

FieldInfo contains information about one structure field without field name.

func (FieldInfo) String added in v1.0.2

func (fi FieldInfo) String() string

type Structure

type Structure map[string]FieldInfo

Structure is a set of fields of one structure.

func Lookup

func Lookup(sl StructureList, structName string) (Structure, error)

Lookup return structure by name from parsed source file or an error if structure with such name not found.

func (Structure) String

func (s Structure) String() string

String return structure information as a string.

type StructureList

type StructureList map[string]Structure

StructureList is a list of parsed structures.

func Parse

func Parse(path string, src io.Reader) (StructureList, error)

Parse gets path to source file or content of source file as a io.Reader and run inspect functions on it. Function returns list of structures with their fields.

Jump to

Keyboard shortcuts

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