parser

package
v0.0.0-...-bf7e435 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2016 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConstValue

type ConstValue struct {
	Name     string
	BaseType string
	Type     string
	Value    interface{}
	FitInt32 bool
}

func (*ConstValue) JSONValue

func (cv *ConstValue) JSONValue() string

JSONValue return const value as should be used in JSON format

type Field

type Field struct {
	Name    string
	Type    string
	Tag     fieldTags
	Comment []string
}

Field represents a field in a struct

func (*Field) ElemType

func (f *Field) ElemType() string

ElemType return type name, skipping container part. For example, if the field type is []string, ElemType will return string.

func (*Field) GoValueName

func (f *Field) GoValueName() string

GoValueName return field name as should be used when assigned to variable

func (*Field) IsArray

func (f *Field) IsArray() bool

func (*Field) IsPointer

func (f *Field) IsPointer() bool

func (*Field) JSONName

func (f *Field) JSONName() string

type Package

type Package struct {
	Name string
	// contains filtered or unexported fields
}

func ParseDir

func ParseDir(directory string, skipSuffix string) (*Package, error)

ParseDir parses the package in the given directory and returns it.

func ParseFiles

func ParseFiles(filenames ...string) (*Package, error)

ParseFiles parses the given files

func (*Package) Alias

func (p *Package) Alias(name string) (*TypeAlias, bool)

func (*Package) ConstValues

func (p *Package) ConstValues() map[string][]*ConstValue

ConstValue return all const declarations

func (*Package) StructType

func (p *Package) StructType(name string) (typ *StructType, ok bool)

StructType returns a StructType if it exists in the package

type StructType

type StructType struct {
	TypeName string
	Fields   map[string]*Field
}

StructType represents a go struct type

type TypeAlias

type TypeAlias struct {
	Name string
	Type string
}

Jump to

Keyboard shortcuts

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