parse

package
v0.0.0-...-39ee509 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2015 License: BSD-2-Clause Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Invalid = iota
	Bool
	Int
	Int8
	Int16
	Int32
	Int64
	Uint
	Uint8
	Uint16
	Uint32
	Uint64
	Float32
	Float64
	Complex64
	Complex128
	Interface
	Bytes
	Map
	Ptr
	String
	Slice
	Struct
)
View Source
const (
	EncodeGzip = "gzip"
	EncodeJson = "json"
)

Variables

View Source
var (
	ErrTypeNotFound = errors.New("Cannot find type in the source code.")
	ErrTypeInvalid  = errors.New("Cannot convert type to a SQL type.")
)
View Source
var Types = map[string]uint8{
	"bool":        Bool,
	"int":         Int,
	"int8":        Int8,
	"int16":       Int16,
	"int32":       Int32,
	"int64":       Int64,
	"uint":        Uint,
	"uint8":       Uint8,
	"uint16":      Uint16,
	"uint32":      Uint32,
	"uint64":      Uint64,
	"float32":     Float32,
	"float64":     Float64,
	"complex64":   Complex64,
	"complex128":  Complex128,
	"interface{}": Interface,
	"[]byte":      Bytes,
	"string":      String,
}

Functions

This section is empty.

Types

type Node

type Node struct {
	Pkg  string // source code package.
	Name string // source code name.
	Kind uint8  // source code kind.
	Type string // source code type.
	Tags *Tag

	Parent *Node
	Nodes  []*Node
}

func Parse

func Parse(path, name string) (*Node, error)

func (*Node) Edges

func (n *Node) Edges() []*Node

Edges returns a flattened list of all edge nodes in the Tree.

func (*Node) Path

func (n *Node) Path() []*Node

Path returns the absolute path of the node in the Tree.

func (*Node) Walk

func (n *Node) Walk(fn func(*Node))

Walk traverses the node tree, invoking the callback function for each node that is traversed.

func (*Node) WalkRev

func (n *Node) WalkRev(fn func(*Node))

WalkRev traverses the tree in reverse order, invoking the callback function for each parent node until the root node is reached.

type Tag

type Tag struct {
	Name    string `yaml:"name"`
	Type    string `yaml:"type"`
	Primary bool   `yaml:"pk"`
	Auto    bool   `yaml:"auto"`
	Index   string `yaml:"index"`
	Unique  string `yaml:"unique"`
	Size    int    `yaml:"size"`
	Skip    bool   `yaml:"skip"`
	Encode  string `yaml:"encode"`
}

Tag stores the parsed data from the tag string in a struct field.

Jump to

Keyboard shortcuts

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