collector

package
v0.0.0-...-dbfed22 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2014 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Mask = errgo.MaskFunc()
)
View Source
var (
	Verbosef = func(f string, v ...interface{}) {}
)

Functions

func Configure

func Configure(verboseLogger Logger)

func PackageImportTask

func PackageImportTask(ctx interface{}) error

Find all files where the middleware package is imported.

func ServeStmtTask

func ServeStmtTask(ctx interface{}) error

func ServerNameTask

func ServerNameTask(ctx interface{}) error

func SourceCodeTask

func SourceCodeTask(ctx interface{}) error

Find all important source code files.

Types

type ClientCollectorI

type ClientCollectorI interface {
	// Generate a clients source code based on the given root path.
	GenerateClient(root string) error

	// Generate a api blueprint based on the given root path.
	ApiBlueprint(root string) (string, error)
}

func NewGoClientCollector

func NewGoClientCollector() ClientCollectorI

type Ctx

type Ctx struct {
	WorkingDir string

	// Variable name of the created middleware server, if any. We assume there is
	// only one created middleware server. Maybe that is not true for all cases.
	ServerName string

	Files []File
}

type File

type File struct {
	// File path of a source code file.
	Path string

	// Go code in string form of a source code file.
	Code string

	// Variable name of the imported middleware package, if any.
	PkgImport string

	// *ast.File of the current go code.
	AstFile *ast.File

	// Serve information describing which routes the middleware server provides.
	ServeStmts []ServeStmt
}

type GoClientCollector

type GoClientCollector struct{}

func (*GoClientCollector) ApiBlueprint

func (gcg *GoClientCollector) ApiBlueprint(root string) (string, error)

func (*GoClientCollector) GenerateClient

func (gcg *GoClientCollector) GenerateClient(wd string) error

type Logger

type Logger func(f string, v ...interface{})

type MiddlewareExpr

type MiddlewareExpr struct {
	FuncExpr     string
	FuncExprType string
	FuncSel      string
}

type ServeStmt

type ServeStmt struct {
	// Http method a route provides.
	Method string

	// Url path of the http route.
	Path string

	// Middleware specs used for a route.
	Middlewares []MiddlewareExpr
}

Jump to

Keyboard shortcuts

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