template

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2017 License: MIT Imports: 7 Imported by: 8

Documentation

Index

Constants

View Source
const (
	PackagePathGoKitEndpoint      = "github.com/go-kit/kit/endpoint"
	PackagePathContext            = "context"
	PackagePathGoKitLog           = "github.com/go-kit/kit/log"
	PackagePathTime               = "time"
	PackagePathGoogleGRPC         = "google.golang.org/grpc"
	PackagePathGoogleGRPCCodes    = "google.golang.org/grpc/codes"
	PackagePathNetContext         = "golang.org/x/net/context"
	PackagePathGoKitTransportGRPC = "github.com/go-kit/kit/transport/grpc"

	TagMark = "// @"

	FileHeader = `This file was automatically generated by "microgen" utility.`
)
View Source
const (
	GolangProtobufPtypesTimestamp = "github.com/golang/protobuf/ptypes/timestamp"
	JsonbPackage                  = "github.com/sas1024/gorm-jsonb/jsonb"
	GolangProtobufPtypes          = "github.com/golang/protobuf/ptypes"
)
View Source
const (
	MiddlewareTypeName = "Middleware"
)

Variables

This section is empty.

Functions

func IsContextFirst added in v0.3.0

func IsContextFirst(fields []types.Variable) bool

func IsErrorLast added in v0.3.0

func IsErrorLast(fields []types.Variable) bool

func RemoveAlreadyExistingFunctions added in v0.3.0

func RemoveAlreadyExistingFunctions(existing []types.Function, generating *[]*types.Function, nameFormer func(*types.Function) string)

Types

type GenerationInfo added in v0.3.0

type GenerationInfo struct {
	ServiceImportPackageName string
	Iface                    *types.Interface
	ServiceImportPath        string
	Force                    bool
	AbsOutPath               string
	SourceFilePath           string

	ProtobufPackage string
	GRPCRegAddr     string
}

type Template added in v0.3.0

type Template interface {
	// Do all preparing actions, e.g. scan file.
	// Should be called first.
	Prepare() error
	// Default relative path for template (=file)
	DefaultPath() string
	// Template chooses generation strategy, e.g. appends to file or create new.
	ChooseStrategy() (write_strategy.Strategy, error)
	// Main render function, where template produce code.
	Render() write_strategy.Renderer
}

func NewEndpointsTemplate added in v0.3.0

func NewEndpointsTemplate(info *GenerationInfo) Template

func NewExchangeTemplate added in v0.3.0

func NewExchangeTemplate(info *GenerationInfo) Template

func NewGRPCClientTemplate added in v0.3.0

func NewGRPCClientTemplate(info *GenerationInfo) Template

func NewGRPCEndpointConverterTemplate added in v0.3.0

func NewGRPCEndpointConverterTemplate(info *GenerationInfo) Template

func NewGRPCServerTemplate added in v0.3.0

func NewGRPCServerTemplate(info *GenerationInfo) Template

func NewLoggingTemplate added in v0.3.0

func NewLoggingTemplate(info *GenerationInfo) Template

func NewMiddlewareTemplate added in v0.3.0

func NewMiddlewareTemplate(info *GenerationInfo) Template

func NewStubGRPCTypeConverterTemplate added in v0.3.0

func NewStubGRPCTypeConverterTemplate(info *GenerationInfo) Template

func NewStubInterfaceTemplate added in v0.3.0

func NewStubInterfaceTemplate(info *GenerationInfo) Template

type WriteStrategyState added in v0.3.0

type WriteStrategyState int
const (
	FileStrat WriteStrategyState = iota + 1
	AppendStrat
)

Jump to

Keyboard shortcuts

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