Documentation ¶
Index ¶
- Constants
- Variables
- func AllowEllipsis(ctx context.Context) bool
- func FetchHttpMethodTag(rawString []string) string
- func IsContextFirst(fields []types.Variable) bool
- func IsErrorLast(fields []types.Variable) bool
- func ParseFile(filename string) (*types.File, error)
- func RemoveContextIfFirst(fields []types.Variable) []types.Variable
- func SourcePackageImport(ctx context.Context) string
- func WithSourcePackageImport(parent context.Context, val string) context.Context
- func WithTags(parent context.Context, tt TagsSet) context.Context
- type BufferAdapter
- func (b *BufferAdapter) Hold() *DelayBuffer
- func (b *BufferAdapter) Ln(a ...interface{})
- func (b *BufferAdapter) Lnf(format string, a ...interface{})
- func (b *BufferAdapter) Printf(format string, a ...interface{})
- func (b *BufferAdapter) Println(a ...interface{})
- func (b *BufferAdapter) Raw(data []byte)
- func (b BufferAdapter) Render(w io.Writer) error
- type DelayBuffer
- type EmptyTemplate
- type GenerationInfo
- type Rendered
- type TagsSet
- type Template
- func NewCacheMiddlewareTemplate(info *GenerationInfo) Template
- func NewEndpointsClientTemplate(info *GenerationInfo) Template
- func NewEndpointsServerTemplate(info *GenerationInfo) Template
- func NewEndpointsTemplate(info *GenerationInfo) Template
- func NewErrorLoggingTemplate(info *GenerationInfo) Template
- func NewExchangeTemplate(info *GenerationInfo) Template
- func NewGRPCClientTemplate(info *GenerationInfo) Template
- func NewGRPCEndpointConverterTemplate(info *GenerationInfo) Template
- func NewGRPCServerTemplate(info *GenerationInfo) Template
- func NewHttpClientTemplate(info *GenerationInfo) Template
- func NewHttpConverterTemplate(info *GenerationInfo) Template
- func NewHttpServerTemplate(info *GenerationInfo) Template
- func NewJSONRPCEndpointConverterTemplate(info *GenerationInfo) Template
- func NewLoggingTemplate(info *GenerationInfo) Template
- func NewMainTemplate(info *GenerationInfo) Template
- func NewMiddlewareTemplate(info *GenerationInfo) Template
- func NewProtoTemplate(info *GenerationInfo, protoPkg string) Template
- func NewRecoverTemplate(info *GenerationInfo) Template
- func NewStubGRPCTypeConverterTemplate(info *GenerationInfo) Template
- func NewStubInterfaceTemplate(info *GenerationInfo) Template
- type WriteStrategyState
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" PackagePathGoogleGRPCStatus = "google.golang.org/grpc/status" PackagePathGoogleGRPCCodes = "google.golang.org/grpc/codes" PackagePathNetContext = "golang.org/x/net/context" PackagePathGoKitTransportGRPC = "github.com/go-kit/kit/transport/grpc" PackagePathHttp = "net/http" PackagePathGoKitTransportHTTP = "github.com/go-kit/kit/transport/http" PackagePathBytes = "bytes" PackagePathJson = "encoding/json" PackagePathIOUtil = "io/ioutil" PackagePathIO = "io" PackagePathStrings = "strings" PackagePathUrl = "net/url" PackagePathEmptyProtobuf = "github.com/golang/protobuf/ptypes/empty" PackagePathFmt = "fmt" PackagePathOs = "os" PackagePathOsSignal = "os/signal" PackagePathSyscall = "syscall" PackagePathErrors = "errors" PackagePathNet = "net" PackagePathGorillaMux = "github.com/gorilla/mux" PackagePathPath = "path" PackagePathStrconv = "strconv" PackagePathOpenTracingGo = "github.com/opentracing/opentracing-go" PackagePathGoKitTracing = "github.com/go-kit/kit/tracing/opentracing" PackagePathGoKitTransportJSONRPC = "github.com/go-kit/kit/transport/http/jsonrpc" PackagePathGoKitMetrics = "github.com/go-kit/kit/metrics" PackagePathGoKitSD = "github.com/go-kit/kit/sd" PackagePathGoKitLB = "github.com/go-kit/kit/sd/lb" PackagePathSyncErrgroup = "golang.org/x/sync/errgroup" TagMark = "// @" MicrogenMainTag = "microgen" )
View Source
const ( MiddlewareTag = "middleware" LoggingMiddlewareTag = "logging" RecoveringMiddlewareTag = "recovering" HttpTag = "http" HttpServerTag = "http-server" HttpClientTag = "http-client" GrpcTag = "grpc" GrpcServerTag = "grpc-server" GrpcClientTag = "grpc-client" MainTag = "main" ErrorLoggingMiddlewareTag = "error-logging" TracingMiddlewareTag = "tracing" CachingMiddlewareTag = "caching" JSONRPCTag = "json-rpc" JSONRPCServerTag = "json-rpc-server" JSONRPCClientTag = "json-rpc-client" Transport = "transport" TransportClient = "transport-client" TransportServer = "transport-server" MetricsMiddlewareTag = "metrics" ServiceDiscoveryTag = "service-discovery" )
View Source
const ( MicrogenExt = ".microgen.go" PathService = "service" PathTransport = "transport" PathExecutable = "cmd" )
View Source
const ( GolangProtobufPtypesTimestamp = "github.com/golang/protobuf/ptypes/timestamp" JsonbPackage = "github.com/sas1024/gorm-jsonb/jsonb" GolangProtobufPtypes = "github.com/golang/protobuf/ptypes" GolangProtobufWrappers = "github.com/golang/protobuf/ptypes/wrappers" )
View Source
const ( HttpMethodTag = "http-method" HttpMethodPath = "http-path" )
View Source
const (
EndpointsSetName = "EndpointsSet"
)
View Source
const (
MiddlewareTypeName = "Middleware"
)
Variables ¶
View Source
var CachingMiddlewareName = mstrings.ToUpperFirst(cachingMiddlewareStructName)
View Source
var (
ErrProtobufEmpty = errors.New("protobuf package is empty")
)
View Source
var ServiceErrorLoggingMiddlewareName = mstrings.ToUpperFirst(serviceErrorLoggingStructName)
View Source
var ServiceLoggingMiddlewareName = mstrings.ToUpperFirst(serviceLoggingStructName)
View Source
var ServiceRecoveringMiddlewareName = mstrings.ToUpperFirst(serviceRecoveringStructName)
Functions ¶
func AllowEllipsis ¶ added in v0.9.0
func FetchHttpMethodTag ¶ added in v0.9.0
func IsContextFirst ¶ added in v0.3.0
func IsErrorLast ¶ added in v0.3.0
func RemoveContextIfFirst ¶ added in v0.9.0
Remove from function fields context if it is first in slice
func SourcePackageImport ¶ added in v0.9.0
func WithSourcePackageImport ¶ added in v0.9.0
Types ¶
type BufferAdapter ¶ added in v0.9.0
type BufferAdapter struct {
// contains filtered or unexported fields
}
func (*BufferAdapter) Hold ¶ added in v0.9.0
func (b *BufferAdapter) Hold() *DelayBuffer
func (*BufferAdapter) Ln ¶ added in v0.9.0
func (b *BufferAdapter) Ln(a ...interface{})
func (*BufferAdapter) Lnf ¶ added in v0.9.0
func (b *BufferAdapter) Lnf(format string, a ...interface{})
func (*BufferAdapter) Printf ¶ added in v0.9.0
func (b *BufferAdapter) Printf(format string, a ...interface{})
func (*BufferAdapter) Println ¶ added in v0.9.0
func (b *BufferAdapter) Println(a ...interface{})
func (*BufferAdapter) Raw ¶ added in v0.9.0
func (b *BufferAdapter) Raw(data []byte)
type DelayBuffer ¶ added in v0.9.0
type DelayBuffer struct { BufferAdapter // contains filtered or unexported fields }
func (*DelayBuffer) Release ¶ added in v0.9.0
func (b *DelayBuffer) Release()
type EmptyTemplate ¶ added in v0.9.0
type EmptyTemplate struct{}
Template for tags, that not produce any files.
func (EmptyTemplate) ChooseStrategy ¶ added in v0.9.0
func (EmptyTemplate) ChooseStrategy(context.Context) (write_strategy.Strategy, error)
func (EmptyTemplate) DefaultPath ¶ added in v0.9.0
func (EmptyTemplate) DefaultPath() string
func (EmptyTemplate) Render ¶ added in v0.9.0
func (EmptyTemplate) Render(context.Context) write_strategy.Renderer
type GenerationInfo ¶ added in v0.3.0
type GenerationInfo struct { Iface *types.Interface SourcePackageImport string SourceFilePath string OutputPackageImport string OutputFilePath string FileHeader string ProtobufPackageImport string ProtobufClientAddr string AllowedMethods map[string]bool }
func (GenerationInfo) String ¶ added in v0.9.0
func (i GenerationInfo) String() string
type Rendered ¶ added in v0.9.0
type Rendered struct {
// contains filtered or unexported fields
}
func (*Rendered) NotContain ¶ added in v0.9.0
type Template ¶ added in v0.3.0
type Template interface { // Do all preparing actions, e.g. scan file. // Should be called first. Prepare(ctx context.Context) error // Default relative path for template (=file) DefaultPath() string // Template chooses generation strategy, e.g. appends to file or create new. ChooseStrategy(ctx context.Context) (write_strategy.Strategy, error) // Main render function, where template produce code. Render(ctx context.Context) write_strategy.Renderer }
func NewCacheMiddlewareTemplate ¶ added in v0.9.0
func NewCacheMiddlewareTemplate(info *GenerationInfo) Template
func NewEndpointsClientTemplate ¶ added in v0.9.0
func NewEndpointsClientTemplate(info *GenerationInfo) Template
func NewEndpointsServerTemplate ¶ added in v0.9.0
func NewEndpointsServerTemplate(info *GenerationInfo) Template
func NewEndpointsTemplate ¶ added in v0.3.0
func NewEndpointsTemplate(info *GenerationInfo) Template
func NewErrorLoggingTemplate ¶ added in v0.9.0
func NewErrorLoggingTemplate(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 NewHttpClientTemplate ¶ added in v0.9.0
func NewHttpClientTemplate(info *GenerationInfo) Template
func NewHttpConverterTemplate ¶ added in v0.9.0
func NewHttpConverterTemplate(info *GenerationInfo) Template
func NewHttpServerTemplate ¶ added in v0.9.0
func NewHttpServerTemplate(info *GenerationInfo) Template
func NewJSONRPCEndpointConverterTemplate ¶ added in v0.9.0
func NewJSONRPCEndpointConverterTemplate(info *GenerationInfo) Template
func NewLoggingTemplate ¶ added in v0.3.0
func NewLoggingTemplate(info *GenerationInfo) Template
func NewMainTemplate ¶ added in v0.9.0
func NewMainTemplate(info *GenerationInfo) Template
func NewMiddlewareTemplate ¶ added in v0.3.0
func NewMiddlewareTemplate(info *GenerationInfo) Template
func NewProtoTemplate ¶ added in v0.9.0
func NewProtoTemplate(info *GenerationInfo, protoPkg string) Template
func NewRecoverTemplate ¶ added in v0.9.0
func NewRecoverTemplate(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 )
Source Files ¶
- buffer_adapter.go
- cmd_main.go
- common.go
- context.go
- prepare_utils.go
- service.go
- service.proto.go
- service_caching.go
- service_error_logging.go
- service_logging.go
- service_middleware.go
- service_recovering.go
- template.go
- transport_client.go
- transport_converter_jsonrpc_exchange_converters.go
- transport_endpoints.go
- transport_exchanges.go
- transport_grpc_client.go
- transport_grpc_protobuf_endpoint_converters.go
- transport_grpc_protobuf_type_converters.go
- transport_grpc_server.go
- transport_http_client.go
- transport_http_converters.go
- transport_http_server.go
- transport_server.go
Click to show internal directories.
Click to hide internal directories.