gocoder

package module
v0.0.0-...-2ef4879 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2017 License: Apache-2.0 Imports: 13 Imported by: 2

README

gocoder

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnyOf

type AnyOf struct {
	Type []string `json:"type"`
}

type GoArray

type GoArray struct {
	// contains filtered or unexported fields
}

func (*GoArray) Ele

func (p *GoArray) Ele() *GoExpr

func (*GoArray) Inspect

func (p *GoArray) Inspect(f InspectFunc, ctx context.Context)

func (*GoArray) Name

func (p *GoArray) Name() string

func (*GoArray) Position

func (p *GoArray) Position() (token.Position, token.Position)

func (*GoArray) Print

func (p *GoArray) Print() error

type GoAssignStmt

type GoAssignStmt struct {
	// contains filtered or unexported fields
}

func (*GoAssignStmt) Inspect

func (p *GoAssignStmt) Inspect(f InspectFunc, ctx context.Context)

func (*GoAssignStmt) IsBasic

func (p *GoAssignStmt) IsBasic() bool

func (*GoAssignStmt) Position

func (p *GoAssignStmt) Position() (token.Position, token.Position)

func (*GoAssignStmt) Print

func (p *GoAssignStmt) Print() error

type GoBasicLit

type GoBasicLit struct {
	// contains filtered or unexported fields
}

func (*GoBasicLit) Inspect

func (p *GoBasicLit) Inspect(f InspectFunc, ctx context.Context)

func (*GoBasicLit) Kind

func (p *GoBasicLit) Kind() string

func (*GoBasicLit) Position

func (p *GoBasicLit) Position() (token.Position, token.Position)

func (*GoBasicLit) Print

func (p *GoBasicLit) Print() error

func (*GoBasicLit) Value

func (p *GoBasicLit) Value() string

type GoCall

type GoCall struct {
	// contains filtered or unexported fields
}

func (*GoCall) Arg

func (p *GoCall) Arg(i int) *GoExpr

func (*GoCall) Func

func (p *GoCall) Func() *GoExpr

func (*GoCall) Name

func (p *GoCall) Name() string

func (*GoCall) NumArgs

func (p *GoCall) NumArgs() int

func (*GoCall) Position

func (p *GoCall) Position() (token.Position, token.Position)

func (*GoCall) Print

func (p *GoCall) Print() error

type GoCompositeLit

type GoCompositeLit struct {
	// contains filtered or unexported fields
}

func (*GoCompositeLit) Inspect

func (p *GoCompositeLit) Inspect(f InspectFunc, ctx context.Context)

func (*GoCompositeLit) Position

func (p *GoCompositeLit) Position() (token.Position, token.Position)

func (*GoCompositeLit) Print

func (p *GoCompositeLit) Print() error

func (*GoCompositeLit) Type

func (p *GoCompositeLit) Type() *GoExpr

type GoExpr

type GoExpr struct {
	// contains filtered or unexported fields
}

func (*GoExpr) Inspect

func (p *GoExpr) Inspect(f InspectFunc, ctx context.Context)

func (*GoExpr) IsArray

func (p *GoExpr) IsArray() bool

func (*GoExpr) IsIdent

func (p *GoExpr) IsIdent() bool

func (*GoExpr) IsInterface

func (p *GoExpr) IsInterface() bool

func (*GoExpr) IsMap

func (p *GoExpr) IsMap() bool

func (*GoExpr) IsSelector

func (p *GoExpr) IsSelector() bool

func (*GoExpr) IsStruct

func (p *GoExpr) IsStruct() bool

func (*GoExpr) Name

func (p *GoExpr) Name() string

func (*GoExpr) Node

func (p *GoExpr) Node() GoNode

func (*GoExpr) Options

func (p *GoExpr) Options() Options

func (*GoExpr) Position

func (p *GoExpr) Position() (begin token.Position, end token.Position)

func (*GoExpr) Print

func (p *GoExpr) Print() error

func (*GoExpr) Root

func (p *GoExpr) Root() *GoExpr

func (*GoExpr) Snippet

func (p *GoExpr) Snippet() (code string, err error)

TODO

func (*GoExpr) String

func (p *GoExpr) String() string

func (*GoExpr) Type

func (p *GoExpr) Type() string

type GoField

type GoField struct {
	// contains filtered or unexported fields
}

func (*GoField) IsExported

func (p *GoField) IsExported() bool

func (*GoField) Name

func (p *GoField) Name(i int) *GoIdent

func (*GoField) NumName

func (p *GoField) NumName() int

func (*GoField) Position

func (p *GoField) Position() (token.Position, token.Position)

func (*GoField) Print

func (p *GoField) Print() error

func (*GoField) Tag

func (p *GoField) Tag() StructTag

func (*GoField) Type

func (p *GoField) Type() *GoType

type GoFieldList

type GoFieldList struct {
	// contains filtered or unexported fields
}

func (*GoFieldList) Field

func (p *GoFieldList) Field(i int) *GoField

func (*GoFieldList) NumFields

func (p *GoFieldList) NumFields() int

func (*GoFieldList) Position

func (p *GoFieldList) Position() (token.Position, token.Position)

func (*GoFieldList) Print

func (p *GoFieldList) Print() error

func (*GoFieldList) TypesAre

func (p *GoFieldList) TypesAre(paramsType ...string) bool

type GoFile

type GoFile struct {
	*GoExpr
	// contains filtered or unexported fields
}

func NewGoFile

func NewGoFile(filename string, options ...Option) (goFile *GoFile, err error)

func (*GoFile) Filename

func (p *GoFile) Filename() string

func (*GoFile) FindImportByName

func (p *GoFile) FindImportByName(name string) (goPkg *GoPackage, exist bool)

func (*GoFile) FindImportByPath

func (p *GoFile) FindImportByPath(importPath string) (*GoPackage, bool)

func (*GoFile) FindType

func (p *GoFile) FindType(typeName string) (goType *GoExpr, exist bool)

func (*GoFile) Func

func (p *GoFile) Func(i int) *GoFunc

func (*GoFile) Imports

func (p *GoFile) Imports() []string

func (*GoFile) InGoRoot

func (p *GoFile) InGoRoot() bool

func (*GoFile) NumFuncs

func (p *GoFile) NumFuncs() int

func (*GoFile) NumTypes

func (p *GoFile) NumTypes() int

func (*GoFile) NumVars

func (p *GoFile) NumVars() int

func (*GoFile) Package

func (p *GoFile) Package() *GoPackage

func (*GoFile) Print

func (p *GoFile) Print() error

func (*GoFile) ShortFilename

func (p *GoFile) ShortFilename() string

func (*GoFile) String

func (p *GoFile) String() string

func (*GoFile) Type

func (p *GoFile) Type(i int) *GoExpr

func (*GoFile) Var

func (p *GoFile) Var(i int) *GoExpr

type GoFunc

type GoFunc struct {
	// contains filtered or unexported fields
}

func (*GoFunc) FindAssigment

func (p *GoFunc) FindAssigment(identName string) (assignStmt *GoAssignStmt, exist bool)

func (*GoFunc) FindCall

func (p *GoFunc) FindCall(funcName string) (call *GoCall, exist bool)

func (*GoFunc) GetReturnStmt

func (p *GoFunc) GetReturnStmt() *GoReturnStmt

func (*GoFunc) Name

func (p *GoFunc) Name() string

func (*GoFunc) Params

func (p *GoFunc) Params() *GoFieldList

func (*GoFunc) Position

func (p *GoFunc) Position() (token.Position, token.Position)

func (*GoFunc) Print

func (p *GoFunc) Print() error

func (*GoFunc) Receiver

func (p *GoFunc) Receiver() string

func (*GoFunc) Results

func (p *GoFunc) Results() *GoFieldList

func (*GoFunc) Root

func (p *GoFunc) Root() *GoExpr

type GoIdent

type GoIdent struct {
	// contains filtered or unexported fields
}

func (*GoIdent) HasObject

func (p *GoIdent) HasObject() bool

func (*GoIdent) Inspect

func (p *GoIdent) Inspect(f InspectFunc, ctx context.Context)

func (*GoIdent) Name

func (p *GoIdent) Name() string

func (*GoIdent) ObjectKind

func (p *GoIdent) ObjectKind() string

func (*GoIdent) Position

func (p *GoIdent) Position() (token.Position, token.Position)

func (*GoIdent) Print

func (p *GoIdent) Print() error

type GoInterface

type GoInterface struct {
	// contains filtered or unexported fields
}

func (*GoInterface) Inspect

func (p *GoInterface) Inspect(f InspectFunc, ctx context.Context)

func (*GoInterface) Position

func (p *GoInterface) Position() (token.Position, token.Position)

func (*GoInterface) Print

func (p *GoInterface) Print() error

type GoMap

type GoMap struct {
	// contains filtered or unexported fields
}

func (*GoMap) Inspect

func (p *GoMap) Inspect(f InspectFunc, ctx context.Context)

func (*GoMap) Key

func (p *GoMap) Key() *GoExpr

func (*GoMap) Name

func (p *GoMap) Name() string

func (*GoMap) Position

func (p *GoMap) Position() (token.Position, token.Position)

func (*GoMap) Print

func (p *GoMap) Print() error

func (*GoMap) Value

func (p *GoMap) Value() *GoExpr

type GoNode

type GoNode interface {
	Position() (begin token.Position, end token.Position)
	Print() error
	// contains filtered or unexported methods
}

type GoNodeInspectable

type GoNodeInspectable interface {
	Inspect(f InspectFunc, ctx context.Context)
}

type GoPackage

type GoPackage struct {
	// contains filtered or unexported fields
}

func NewGoPackage

func NewGoPackage(pkgPath string, options ...Option) (goPackage *GoPackage, err error)

func (*GoPackage) File

func (p *GoPackage) File(i int) *GoFile

func (*GoPackage) FindFunc

func (p *GoPackage) FindFunc(funcName string) (fn *GoFunc, exist bool)

func (*GoPackage) FindType

func (p *GoPackage) FindType(typeName string) (goType *GoExpr, exist bool)

func (*GoPackage) Func

func (p *GoPackage) Func(funcIndex int) *GoFunc

func (*GoPackage) InGoRoot

func (p *GoPackage) InGoRoot() bool

func (*GoPackage) Name

func (p *GoPackage) Name() string

func (*GoPackage) NumFile

func (p *GoPackage) NumFile() int

func (*GoPackage) NumFuncs

func (p *GoPackage) NumFuncs() int

func (*GoPackage) NumTypes

func (p *GoPackage) NumTypes() int

func (*GoPackage) NumVars

func (p *GoPackage) NumVars() int

func (*GoPackage) Options

func (p *GoPackage) Options() Options

func (*GoPackage) PackageDir

func (p *GoPackage) PackageDir() string

func (*GoPackage) Path

func (p *GoPackage) Path() string

func (*GoPackage) Type

func (p *GoPackage) Type(typeIndex int) *GoExpr

func (*GoPackage) Var

func (p *GoPackage) Var(varIndex int) *GoExpr

type GoPackageOption

type GoPackageOption func(*GoPackage) error

type GoReturnStmt

type GoReturnStmt struct {
	// contains filtered or unexported fields
}

func (*GoReturnStmt) NumResults

func (p *GoReturnStmt) NumResults() int

func (*GoReturnStmt) Position

func (p *GoReturnStmt) Position() token.Position

func (*GoReturnStmt) Print

func (p *GoReturnStmt) Print() error

func (*GoReturnStmt) Result

func (p *GoReturnStmt) Result(i int) *GoExpr

type GoSelector

type GoSelector struct {
	// contains filtered or unexported fields
}

func (*GoSelector) GetSelName

func (p *GoSelector) GetSelName() string

func (*GoSelector) Inspect

func (p *GoSelector) Inspect(f InspectFunc, ctx context.Context)

func (*GoSelector) IsInOtherPackage

func (p *GoSelector) IsInOtherPackage() bool

func (*GoSelector) Position

func (p *GoSelector) Position() (token.Position, token.Position)

func (*GoSelector) Print

func (p *GoSelector) Print() error

func (*GoSelector) UsingPackage

func (p *GoSelector) UsingPackage() *GoPackage

func (*GoSelector) X

func (p *GoSelector) X() *GoExpr

type GoStar

type GoStar struct {
	// contains filtered or unexported fields
}

func (*GoStar) Inspect

func (p *GoStar) Inspect(f InspectFunc, ctx context.Context)

func (*GoStar) Position

func (p *GoStar) Position() (token.Position, token.Position)

func (*GoStar) Print

func (p *GoStar) Print() error

func (*GoStar) X

func (p *GoStar) X() *GoExpr

type GoStruct

type GoStruct struct {
	// contains filtered or unexported fields
}

func (*GoStruct) Field

func (p *GoStruct) Field(i int) *GoField

func (*GoStruct) Name

func (p *GoStruct) Name() string

func (*GoStruct) NumFields

func (p *GoStruct) NumFields() int

func (*GoStruct) Position

func (p *GoStruct) Position() (token.Position, token.Position)

func (*GoStruct) Print

func (p *GoStruct) Print() error

type GoType

type GoType struct {
	// contains filtered or unexported fields
}

func (*GoType) Inspect

func (p *GoType) Inspect(f InspectFunc, ctx context.Context)

func (*GoType) IsArray

func (p *GoType) IsArray() bool

func (*GoType) IsInterface

func (p *GoType) IsInterface() bool

func (*GoType) IsMap

func (p *GoType) IsMap() bool

func (*GoType) IsSelector

func (p *GoType) IsSelector() bool

func (*GoType) IsStruct

func (p *GoType) IsStruct() bool

func (*GoType) Method

func (p *GoType) Method(i int) *GoFunc

func (*GoType) MethodByName

func (p *GoType) MethodByName(name string) *GoFunc

func (*GoType) Node

func (p *GoType) Node() GoNode

func (*GoType) NumMethods

func (p *GoType) NumMethods() int

func (*GoType) Position

func (p *GoType) Position() (token.Position, token.Position)

func (*GoType) Print

func (p *GoType) Print() error

func (*GoType) String

func (p *GoType) String() string

type GoUnary

type GoUnary struct {
	// contains filtered or unexported fields
}

func (*GoUnary) Inspect

func (p *GoUnary) Inspect(f InspectFunc, ctx context.Context)

func (*GoUnary) Position

func (p *GoUnary) Position() (token.Position, token.Position)

func (*GoUnary) Print

func (p *GoUnary) Print() error

type InspectFunc

type InspectFunc func(GoNode, context.Context) bool

type JsonSchema

type JsonSchema struct {
	Schema     string                 `json:"$schema,omitempty"`
	Id         string                 `json:"id,omitempty"`
	Type       string                 `json:"type,omitempty"`
	AnyOf      *AnyOf                 `json:"anyOf,omitempty"`
	Items      *JsonSchema            `json:"items,omitempty"`
	Properties map[string]*JsonSchema `json:"properties,omitempty"`
}

func NodeToJsonSchema

func NodeToJsonSchema(goNode GoNode) (schema JsonSchema, err error)

type Option

type Option func(*Options) error

func OptionExprInGoFile

func OptionExprInGoFile(gofile *GoFile) Option

func OptionGoPackage

func OptionGoPackage(goPkg *GoPackage) Option

func OptionGoPath

func OptionGoPath(gopath string) Option

func OptionGoRoot

func OptionGoRoot(goroot string) Option

func OptionImportByFile

func OptionImportByFile(file *GoFile) Option

func OptionImportByPackage

func OptionImportByPackage(pkg *GoPackage) Option

type Options

type Options struct {
	GoPath          string
	GoRoot          string
	GoPackage       *GoPackage
	GoFile          *GoFile
	ImportByPackage *GoPackage
	ImportByFile    *GoFile
	// contains filtered or unexported fields
}

func (*Options) Copy

func (p *Options) Copy() []Option

func (*Options) Fallback

func (p *Options) Fallback(opts ...Option) (err error)

type StructTag

type StructTag string

func (StructTag) Get

func (tag StructTag) Get(key string) string

Get returns the value associated with key in the tag string. If there is no such key in the tag, Get returns the empty string. If the tag does not have the conventional format, the value returned by Get is unspecified. To determine whether a tag is explicitly set to the empty string, use Lookup.

func (StructTag) Lookup

func (tag StructTag) Lookup(key string) (value string, ok bool)

Lookup returns the value associated with key in the tag string. If the key is present in the tag the value (which may be empty) is returned. Otherwise the returned value will be the empty string. The ok return value reports whether the value was explicitly set in the tag string. If the tag does not have the conventional format, the value returned by Lookup is unspecified.

Jump to

Keyboard shortcuts

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