Documentation ¶
Overview ¶
* Copyright © 2017 Xiao Zhang <zzxx513@gmail.com>. * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file.
* Copyright © 2017 Xiao Zhang <zzxx513@gmail.com>. * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file.
* Copyright © 2017 Xiao Zhang <zzxx513@gmail.com>. * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file.
* Copyright © 2017 Xiao Zhang <zzxx513@gmail.com>. * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file.
* Copyright © 2017 Xiao Zhang <zzxx513@gmail.com>. * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file.
* Copyright © 2017 Xiao Zhang <zzxx513@gmail.com>. * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file.
* Copyright © 2017 Xiao Zhang <zzxx513@gmail.com>. * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file.
* Copyright © 2017 Xiao Zhang <zzxx513@gmail.com>. * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file.
* Copyright © 2017 Xiao Zhang <zzxx513@gmail.com>. * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file.
* Copyright © 2017 Xiao Zhang <zzxx513@gmail.com>. * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file.
* Copyright © 2017 Xiao Zhang <zzxx513@gmail.com>. * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file.
* Copyright © 2017 Xiao Zhang <zzxx513@gmail.com>. * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file.
Index ¶
- Variables
- func BuildArgs(s Servable, argsType reflect.Type, argsValue reflect.Value, req *http.Request, ...) ([]reflect.Value, error)
- func BuildRequest(s Servable, v proto.Message, req *http.Request) error
- func BuildStruct(s Servable, theType reflect.Type, theValue reflect.Value, req *http.Request)
- func BuildThriftRequest(s Servable, args interface{}, req *http.Request, ...) ([]reflect.Value, error)
- func GetWD() string
- func GrpcMetadataHeader(ctx context.Context) *metadata.MD
- func GrpcMetadataPeer(ctx context.Context) *peer.Peer
- func GrpcMetadataTrailer(ctx context.Context) *metadata.MD
- func IsCamelCase(name string) bool
- func IsNotCamelCase(name string) bool
- func SetOutput(out io.Writer)
- func ToSnakeCase(str string) string
- func WithCallOptions(req *http.Request, header *metadata.MD, trailer *metadata.MD, peer *peer.Peer)
- type BaseInterceptor
- type Components
- func (c *Components) CommonInterceptors() []Interceptor
- func (c *Components) Convertor(theType string) Convertor
- func (c *Components) Hijacker(req *http.Request) Hijacker
- func (c *Components) Intercept(methods []string, urlPattern string, list ...Interceptor)
- func (c *Components) Interceptors(req *http.Request) Interceptors
- func (c *Components) Postprocessor(req *http.Request) Postprocessor
- func (c *Components) Preprocessor(req *http.Request) Preprocessor
- func (c *Components) Reset()
- func (c *Components) SetCommonInterceptor(interceptors ...Interceptor)
- func (c *Components) SetConvertor(field string, convertorFunc Convertor)
- func (c *Components) SetHijacker(methods []string, urlPattern string, h Hijacker)
- func (c *Components) SetPostprocessor(methods []string, urlPattern string, post Postprocessor)
- func (c *Components) SetPreprocessor(methods []string, urlPattern string, pre Preprocessor)
- func (c *Components) WithErrorHandler(e ErrorHandlerFunc)
- type Config
- func (c *Config) Env() string
- func (c *Config) ErrorHandler() string
- func (c *Config) FileRootPath() string
- func (c *Config) FilterProtoJson() bool
- func (c *Config) FilterProtoJsonEmitZeroValues() bool
- func (c *Config) FilterProtoJsonInt64AsNumber() bool
- func (c *Config) GrpcServiceHost() string
- func (c *Config) GrpcServiceNames() []string
- func (c *Config) GrpcServicePort() string
- func (c *Config) HTTPPort() int64
- func (c *Config) PackagePath() string
- func (c *Config) ServiceRootPath() string
- func (c *Config) ThriftServiceHost() string
- func (c *Config) ThriftServiceNames() []string
- func (c *Config) ThriftServicePort() string
- type ContextHook
- type Convertor
- type Creator
- type ErrorHandlerFunc
- type Generator
- type GrpcServer
- func (s *GrpcServer) ServerField() *Server
- func (s *GrpcServer) Service(serviceName string) interface{}
- func (s *GrpcServer) Start(clientCreator grpcClientCreator, sw switcher, ...)
- func (s *GrpcServer) StartGrpcService(registerServer func(s *grpc.Server))
- func (s *GrpcServer) StartHTTPServer(clientCreator grpcClientCreator, sw switcher)
- func (s *GrpcServer) Stop()
- type Hijacker
- type Initializable
- type Interceptor
- type Interceptors
- type Marshaler
- type Postprocessor
- type Preprocessor
- type Servable
- type Server
- type TestPrimitives
- func (*TestPrimitives) Descriptor() ([]byte, []int)deprecated
- func (x *TestPrimitives) GetBoolValue() bool
- func (x *TestPrimitives) GetFloat32Value() float32
- func (x *TestPrimitives) GetFloat64Value() float64
- func (x *TestPrimitives) GetInt32Value() int32
- func (x *TestPrimitives) GetInt64Value() int64
- func (x *TestPrimitives) GetUint32Value() uint32
- func (x *TestPrimitives) GetUint64Value() uint64
- func (*TestPrimitives) ProtoMessage()
- func (x *TestPrimitives) ProtoReflect() protoreflect.Message
- func (x *TestPrimitives) Reset()
- func (x *TestPrimitives) String() string
- type TestProtoStruct
- type TestTags
- type TestTagsData
- func (*TestTagsData) Descriptor() ([]byte, []int)deprecated
- func (x *TestTagsData) GetBitrate() int32
- func (x *TestTagsData) GetContentTypeId() int64
- func (x *TestTagsData) GetCreativeApiId() int64
- func (x *TestTagsData) GetDuration() int32
- func (x *TestTagsData) GetFps() float32
- func (x *TestTagsData) GetHeight() int32
- func (x *TestTagsData) GetId3Tag() string
- func (x *TestTagsData) GetMetadataOnly() string
- func (x *TestTagsData) GetPhysicalDuration() float32
- func (x *TestTagsData) GetUploadFile() string
- func (x *TestTagsData) GetUploadUrl() string
- func (x *TestTagsData) GetWidth() int32
- func (*TestTagsData) ProtoMessage()
- func (x *TestTagsData) ProtoReflect() protoreflect.Message
- func (x *TestTagsData) Reset()
- func (x *TestTagsData) String() string
- type ThriftServer
- func (s *ThriftServer) ServerField() *Server
- func (s *ThriftServer) Service(serviceName string) interface{}
- func (s *ThriftServer) Start(clientCreator thriftClientCreator, sw switcher, ...)
- func (s *ThriftServer) StartHTTPServer(clientCreator thriftClientCreator, sw switcher)
- func (s *ThriftServer) StartThriftService(registerTProcessor processorRegister)
- func (s *ThriftServer) Stop()
Constants ¶
This section is empty.
Variables ¶
var CallOptions = func(serviceName, methodName string, req *http.Request) ([]grpc.CallOption, *metadata.MD, *metadata.MD, *peer.Peer) { header := new(metadata.MD) trailer := new(metadata.MD) peer := &peer.Peer{} callOptions := []grpc.CallOption{ grpc.Header(header), grpc.Trailer(trailer), grpc.Peer(peer), } return callOptions, header, trailer, peer }
CallOptions returns grpc CallOptions, you can overwrite this func to build CallOptions for your needs.
var File_testprotos_proto protoreflect.FileDescriptor
var RpcType string
RpcType should be "grpc" or "thrift"
Functions ¶
func BuildArgs ¶
func BuildArgs(s Servable, argsType reflect.Type, argsValue reflect.Value, req *http.Request, buildStructArg func(s Servable, typeName string, req *http.Request) (v reflect.Value, err error)) ([]reflect.Value, error)
BuildArgs returns a list of reflect.Value for thrift request
func BuildStruct ¶
BuildStruct finds values from request, and set them to struct fields recursively
func BuildThriftRequest ¶
func GrpcMetadataHeader ¶
GrpcMetadataHeader returns the header in metadata
func GrpcMetadataPeer ¶
GrpcMetadataPeer returns the peer in metadata
func GrpcMetadataTrailer ¶
GrpcMetadataTrailer returns the trailer in metadata
func IsCamelCase ¶
IsCamelCase returns true if name is a CamelCase string
func IsNotCamelCase ¶
IsNotCamelCase returns true if name is not a CamelCase string
func ToSnakeCase ¶
ToSnakeCase convert a camelCase string into a snake_case string
Types ¶
type BaseInterceptor ¶
type BaseInterceptor struct{}
BaseInterceptor implements an empty Before() and After()
func (*BaseInterceptor) After ¶
func (i *BaseInterceptor) After(resp http.ResponseWriter, req *http.Request) error
After will run after a request performs
func (*BaseInterceptor) Before ¶
func (i *BaseInterceptor) Before(resp http.ResponseWriter, req *http.Request) error
Before will run before a request performs
type Components ¶
type Components struct {
// contains filtered or unexported fields
}
Components holds all component mappings
func (*Components) CommonInterceptors ¶
func (c *Components) CommonInterceptors() []Interceptor
CommonInterceptors returns a list of Interceptors which are default
func (*Components) Convertor ¶
func (c *Components) Convertor(theType string) Convertor
Convertor returns the Convertor for this type
func (*Components) Hijacker ¶
func (c *Components) Hijacker(req *http.Request) Hijacker
Hijacker returns a Hijacker for this request
func (*Components) Intercept ¶
func (c *Components) Intercept(methods []string, urlPattern string, list ...Interceptor)
Intercept registers a list of Interceptors to an URL pattern at given HTTP methods
func (*Components) Interceptors ¶
func (c *Components) Interceptors(req *http.Request) Interceptors
Interceptors returns a list of Interceptors for this request
func (*Components) Postprocessor ¶
func (c *Components) Postprocessor(req *http.Request) Postprocessor
Postprocessor returns a Postprocessor for this request
func (*Components) Preprocessor ¶
func (c *Components) Preprocessor(req *http.Request) Preprocessor
Preprocessor returns a preprocessor for this request
func (*Components) SetCommonInterceptor ¶
func (c *Components) SetCommonInterceptor(interceptors ...Interceptor)
SetCommonInterceptor assigns Interceptors to all URLs, if the URL has no other Interceptors assigned
func (*Components) SetConvertor ¶
func (c *Components) SetConvertor(field string, convertorFunc Convertor)
SetConvertor registers a Convertor on a type usage: SetConvertor(new(SomeInterface), convertorFunc)
func (*Components) SetHijacker ¶
func (c *Components) SetHijacker(methods []string, urlPattern string, h Hijacker)
SetHijacker registers a Hijacker to an URL pattern
func (*Components) SetPostprocessor ¶
func (c *Components) SetPostprocessor(methods []string, urlPattern string, post Postprocessor)
SetPostprocessor registers a Postprocessor to an URL pattern
func (*Components) SetPreprocessor ¶
func (c *Components) SetPreprocessor(methods []string, urlPattern string, pre Preprocessor)
SetPreprocessor registers a preprocessor to an URL pattern
func (*Components) WithErrorHandler ¶
func (c *Components) WithErrorHandler(e ErrorHandlerFunc)
WithErrorHandler registers an errorHandler to handle errors
type Config ¶
type Config struct { viper.Viper // File is the config file path File string // contains filtered or unexported fields }
Config holds the info in a config file
func NewConfig ¶
NewConfig loads the config file at 'configFilePath', and returns a Config struct ptr
func (*Config) ErrorHandler ¶
func (*Config) FileRootPath ¶ added in v0.4.0
FileRootPath returns the absolute path to the root of packages,
func (*Config) FilterProtoJson ¶
func (*Config) FilterProtoJsonEmitZeroValues ¶
func (*Config) FilterProtoJsonInt64AsNumber ¶
func (*Config) GrpcServiceHost ¶
func (*Config) GrpcServiceNames ¶
func (*Config) GrpcServicePort ¶
func (*Config) PackagePath ¶ added in v0.4.0
PackagePath returns the base package name,
func (*Config) ServiceRootPath ¶
ServiceRootPath returns the absolute path to service's root,
func (*Config) ThriftServiceHost ¶
func (*Config) ThriftServiceNames ¶
func (*Config) ThriftServicePort ¶
type ContextHook ¶
type ContextHook struct{}
ContextHook is a hook to be fired when logging on the logging levels returned from `Levels()` on your implementation of the interface. Note that this is not fired in a goroutine or a channel with workers, you should handle such functionality yourself if your call is non-blocking and you don't wish for the logging calls for levels returned from `Levels()` to block.
The original hook interface is:
type Hook interface { Levels() []Level Fire(*Entry) error }
func (ContextHook) Fire ¶
func (hook ContextHook) Fire(entry *logger.Entry) error
Fire is for adding file, func and line info to logger.
func (ContextHook) Levels ¶
func (hook ContextHook) Levels() []logger.Level
Levels returns active log levels
type Creator ¶
type Creator struct { RpcType string PkgPath string FileRootPath string // contains filtered or unexported fields }
Creator creates new projects
func (*Creator) CreateProject ¶
CreateProject creates a whole new project!
type ErrorHandlerFunc ¶
type ErrorHandlerFunc func(http.ResponseWriter, *http.Request, error)
ErrorHandler----------
type Generator ¶
type Generator struct { RpcType string PkgPath string ConfigFileName string Options string FilePaths []string // contains filtered or unexported fields }
Generator generates proto/thrift code
func (*Generator) GenerateBuildThriftParameters ¶
func (g *Generator) GenerateBuildThriftParameters()
GenerateBuildThriftParameters generates "build.go"
func (*Generator) GenerateGrpcSwitcher ¶
func (g *Generator) GenerateGrpcSwitcher()
GenerateGrpcSwitcher generates "grpcswither.go"
func (*Generator) GenerateProtobufStub ¶
func (g *Generator) GenerateProtobufStub()
GenerateProtobufStub generates protobuf stub codes
func (*Generator) GenerateThriftStub ¶
func (g *Generator) GenerateThriftStub()
GenerateThriftStub generates Thrift stub codes
func (*Generator) GenerateThriftSwitcher ¶
func (g *Generator) GenerateThriftSwitcher()
GenerateThriftSwitcher generates "thriftswitcher.go"
type GrpcServer ¶
type GrpcServer struct { *Server // contains filtered or unexported fields }
func NewGrpcServer ¶
func NewGrpcServer(initializer Initializable, configFilePath string) *GrpcServer
func (*GrpcServer) ServerField ¶
func (s *GrpcServer) ServerField() *Server
func (*GrpcServer) Service ¶
func (s *GrpcServer) Service(serviceName string) interface{}
GrpcService returns a grpc client instance, example: client := turbo.GrpcService().(proto.YourServiceClient)
func (*GrpcServer) Start ¶
func (s *GrpcServer) Start(clientCreator grpcClientCreator, sw switcher, registerServer func(s *grpc.Server))
Start starts both HTTP server and GRPC service
func (*GrpcServer) StartGrpcService ¶
func (s *GrpcServer) StartGrpcService(registerServer func(s *grpc.Server))
StartGrpcService starts a GRPC service
func (*GrpcServer) StartHTTPServer ¶
func (s *GrpcServer) StartHTTPServer(clientCreator grpcClientCreator, sw switcher)
StartHTTPServer starts a HTTP server which sends requests via grpc
func (*GrpcServer) Stop ¶
func (s *GrpcServer) Stop()
type Initializable ¶
type Initializable interface { // InitService is run before the service is started, do initializing staffs for your service here InitService(s Servable) error // StopService is run after both grpc server and http server are stopped, // do your cleaning up work here. StopService(s Servable) }
Initializable defines funcs run before service started and after service stopped
type Interceptor ¶
type Interceptor interface { Before(http.ResponseWriter, *http.Request) error After(http.ResponseWriter, *http.Request) error }
Interceptor intercepts requests, can run a func before and after a request
type Interceptors ¶
type Interceptors []Interceptor
func (Interceptors) ServeHTTP ¶
func (i Interceptors) ServeHTTP(http.ResponseWriter, *http.Request)
ServeHTTP is an empty func, only for implementing http.Handler
type Marshaler ¶
Marshaler marshals a struct to JSON
func (*Marshaler) FilterJsonWithStruct ¶
func (m *Marshaler) FilterJsonWithStruct(jsonBytes []byte, structObj interface{}) (bytes []byte, e error)
FilterJsonWithStruct walks through a struct, comparing each struct field with the key which have same name('fieldName'=='field_name') in json, and change the json by: 1, if struct field type is 'int64', then change the value in Json into a number 2, if field type is 'Ptr', and field value is 'nil', then set "[key_name]":null in Json 3, if any key in json is missing, set zero value to that key The reason why we do this is (a) protobuf parse int64 as string, (b) a Key with a nil Ptr value is missing in the json marshaled by github.com/golang/protobuf/jsonpb.Marshaler So, this func is a 'patch' to protobuf
type Postprocessor ¶
PostProcessor--------------
func (Postprocessor) ServeHTTP ¶
func (p Postprocessor) ServeHTTP(http.ResponseWriter, *http.Request)
ServeHTTP is an empty func, only for implementing http.Handler
type Preprocessor ¶
type Preprocessor func(http.ResponseWriter, *http.Request) error
PreProcessor-------------
func (Preprocessor) ServeHTTP ¶
func (p Preprocessor) ServeHTTP(http.ResponseWriter, *http.Request)
ServeHTTP is an empty func, only for implementing http.Handler
type Server ¶
type Server struct { // Config holds data read from config file Config *Config // Components holds the mappings of url to component Components *Components // Initializer implements Initializable Initializer Initializable // contains filtered or unexported fields }
Server holds the data for a server
func (*Server) RegisterComponent ¶
RegisterComponent registers a component, The convention is to register with the name of that component, the name is used in config file to look up for a component.
func (*Server) ServerField ¶
type TestPrimitives ¶ added in v0.4.0
type TestPrimitives struct { Int64Value int64 `protobuf:"varint,1,opt,name=Int64Value,json=int64Value,proto3" json:"Int64Value,omitempty"` Int32Value int32 `protobuf:"zigzag32,2,opt,name=Int32Value,json=int32Value,proto3" json:"Int32Value,omitempty"` Uint64Value uint64 `protobuf:"varint,3,opt,name=Uint64Value,json=uint64Value,proto3" json:"Uint64Value,omitempty"` Uint32Value uint32 `protobuf:"varint,4,opt,name=Uint32Value,json=uint32Value,proto3" json:"Uint32Value,omitempty"` Float32Value float32 `protobuf:"fixed32,5,opt,name=Float32Value,json=float32Value,proto3" json:"Float32Value,omitempty"` Float64Value float64 `protobuf:"fixed64,6,opt,name=Float64Value,json=float64Value,proto3" json:"Float64Value,omitempty"` BoolValue bool `protobuf:"varint,7,opt,name=BoolValue,json=boolValue,proto3" json:"BoolValue,omitempty"` // contains filtered or unexported fields }
func (*TestPrimitives) Descriptor
deprecated
added in
v0.4.0
func (*TestPrimitives) Descriptor() ([]byte, []int)
Deprecated: Use TestPrimitives.ProtoReflect.Descriptor instead.
func (*TestPrimitives) GetBoolValue ¶ added in v0.4.0
func (x *TestPrimitives) GetBoolValue() bool
func (*TestPrimitives) GetFloat32Value ¶ added in v0.4.0
func (x *TestPrimitives) GetFloat32Value() float32
func (*TestPrimitives) GetFloat64Value ¶ added in v0.4.0
func (x *TestPrimitives) GetFloat64Value() float64
func (*TestPrimitives) GetInt32Value ¶ added in v0.4.0
func (x *TestPrimitives) GetInt32Value() int32
func (*TestPrimitives) GetInt64Value ¶ added in v0.4.0
func (x *TestPrimitives) GetInt64Value() int64
func (*TestPrimitives) GetUint32Value ¶ added in v0.4.0
func (x *TestPrimitives) GetUint32Value() uint32
func (*TestPrimitives) GetUint64Value ¶ added in v0.4.0
func (x *TestPrimitives) GetUint64Value() uint64
func (*TestPrimitives) ProtoMessage ¶ added in v0.4.0
func (*TestPrimitives) ProtoMessage()
func (*TestPrimitives) ProtoReflect ¶ added in v0.4.0
func (x *TestPrimitives) ProtoReflect() protoreflect.Message
func (*TestPrimitives) Reset ¶ added in v0.4.0
func (x *TestPrimitives) Reset()
func (*TestPrimitives) String ¶ added in v0.4.0
func (x *TestPrimitives) String() string
type TestProtoStruct ¶ added in v0.4.0
type TestProtoStruct struct { Value int64 `protobuf:"varint,1,opt,name=Value,json=value,proto3" json:"Value,omitempty"` // contains filtered or unexported fields }
func (*TestProtoStruct) Descriptor
deprecated
added in
v0.4.0
func (*TestProtoStruct) Descriptor() ([]byte, []int)
Deprecated: Use TestProtoStruct.ProtoReflect.Descriptor instead.
func (*TestProtoStruct) GetValue ¶ added in v0.4.0
func (x *TestProtoStruct) GetValue() int64
func (*TestProtoStruct) ProtoMessage ¶ added in v0.4.0
func (*TestProtoStruct) ProtoMessage()
func (*TestProtoStruct) ProtoReflect ¶ added in v0.4.0
func (x *TestProtoStruct) ProtoReflect() protoreflect.Message
func (*TestProtoStruct) Reset ¶ added in v0.4.0
func (x *TestProtoStruct) Reset()
func (*TestProtoStruct) String ¶ added in v0.4.0
func (x *TestProtoStruct) String() string
type TestTags ¶ added in v0.4.0
type TestTags struct { Data *TestTagsData `protobuf:"bytes,1,opt,name=Data,json=data,proto3" json:"Data,omitempty"` // contains filtered or unexported fields }
func (*TestTags) Descriptor
deprecated
added in
v0.4.0
func (*TestTags) GetData ¶ added in v0.4.0
func (x *TestTags) GetData() *TestTagsData
func (*TestTags) ProtoMessage ¶ added in v0.4.0
func (*TestTags) ProtoMessage()
func (*TestTags) ProtoReflect ¶ added in v0.4.0
func (x *TestTags) ProtoReflect() protoreflect.Message
type TestTagsData ¶ added in v0.4.0
type TestTagsData struct { UploadFile string `protobuf:"bytes,1,opt,name=UploadFile,json=uploadFile,proto3" json:"UploadFile,omitempty"` UploadUrl string `protobuf:"bytes,2,opt,name=UploadUrl,json=uploadUrl,proto3" json:"UploadUrl,omitempty"` MetadataOnly string `protobuf:"bytes,3,opt,name=MetadataOnly,json=metadataOnly,proto3" json:"MetadataOnly,omitempty"` ContentTypeId int64 `protobuf:"varint,4,opt,name=ContentTypeId,json=contentTypeId,proto3" json:"ContentTypeId,omitempty"` CreativeApiId int64 `protobuf:"varint,5,opt,name=CreativeApiId,json=creativeApiId,proto3" json:"CreativeApiId,omitempty"` Duration int32 `protobuf:"zigzag32,6,opt,name=Duration,json=duration,proto3" json:"Duration,omitempty"` PhysicalDuration float32 `protobuf:"fixed32,7,opt,name=PhysicalDuration,json=physicalDuration,proto3" json:"PhysicalDuration,omitempty"` Bitrate int32 `protobuf:"zigzag32,8,opt,name=Bitrate,json=bitrate,proto3" json:"Bitrate,omitempty"` Height int32 `protobuf:"zigzag32,9,opt,name=Height,json=height,proto3" json:"Height,omitempty"` Width int32 `protobuf:"zigzag32,10,opt,name=Width,json=width,proto3" json:"Width,omitempty"` Fps float32 `protobuf:"fixed32,11,opt,name=Fps,json=fps,proto3" json:"Fps,omitempty"` Id3Tag string `protobuf:"bytes,12,opt,name=Id3Tag,json=id3Tag,proto3" json:"Id3Tag,omitempty"` // contains filtered or unexported fields }
func (*TestTagsData) Descriptor
deprecated
added in
v0.4.0
func (*TestTagsData) Descriptor() ([]byte, []int)
Deprecated: Use TestTagsData.ProtoReflect.Descriptor instead.
func (*TestTagsData) GetBitrate ¶ added in v0.4.0
func (x *TestTagsData) GetBitrate() int32
func (*TestTagsData) GetContentTypeId ¶ added in v0.4.0
func (x *TestTagsData) GetContentTypeId() int64
func (*TestTagsData) GetCreativeApiId ¶ added in v0.4.0
func (x *TestTagsData) GetCreativeApiId() int64
func (*TestTagsData) GetDuration ¶ added in v0.4.0
func (x *TestTagsData) GetDuration() int32
func (*TestTagsData) GetFps ¶ added in v0.4.0
func (x *TestTagsData) GetFps() float32
func (*TestTagsData) GetHeight ¶ added in v0.4.0
func (x *TestTagsData) GetHeight() int32
func (*TestTagsData) GetId3Tag ¶ added in v0.4.0
func (x *TestTagsData) GetId3Tag() string
func (*TestTagsData) GetMetadataOnly ¶ added in v0.4.0
func (x *TestTagsData) GetMetadataOnly() string
func (*TestTagsData) GetPhysicalDuration ¶ added in v0.4.0
func (x *TestTagsData) GetPhysicalDuration() float32
func (*TestTagsData) GetUploadFile ¶ added in v0.4.0
func (x *TestTagsData) GetUploadFile() string
func (*TestTagsData) GetUploadUrl ¶ added in v0.4.0
func (x *TestTagsData) GetUploadUrl() string
func (*TestTagsData) GetWidth ¶ added in v0.4.0
func (x *TestTagsData) GetWidth() int32
func (*TestTagsData) ProtoMessage ¶ added in v0.4.0
func (*TestTagsData) ProtoMessage()
func (*TestTagsData) ProtoReflect ¶ added in v0.4.0
func (x *TestTagsData) ProtoReflect() protoreflect.Message
func (*TestTagsData) Reset ¶ added in v0.4.0
func (x *TestTagsData) Reset()
func (*TestTagsData) String ¶ added in v0.4.0
func (x *TestTagsData) String() string
type ThriftServer ¶
type ThriftServer struct { *Server // contains filtered or unexported fields }
func NewThriftServer ¶
func NewThriftServer(initializer Initializable, configFilePath string) *ThriftServer
func (*ThriftServer) ServerField ¶
func (s *ThriftServer) ServerField() *Server
func (*ThriftServer) Service ¶
func (s *ThriftServer) Service(serviceName string) interface{}
ThriftService returns a Thrift client instance, example: client := turbo.ThriftService().(proto.YourServiceClient)
func (*ThriftServer) Start ¶
func (s *ThriftServer) Start(clientCreator thriftClientCreator, sw switcher, registerTProcessor processorRegister)
Start starts both HTTP server and Thrift service
func (*ThriftServer) StartHTTPServer ¶
func (s *ThriftServer) StartHTTPServer(clientCreator thriftClientCreator, sw switcher)
StartHTTPServer starts a HTTP server which sends requests via Thrift
func (*ThriftServer) StartThriftService ¶
func (s *ThriftServer) StartThriftService(registerTProcessor processorRegister)
StartThriftService starts a Thrift service
func (*ThriftServer) Stop ¶
func (s *ThriftServer) Stop()
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
* Copyright © 2017 Xiao Zhang <zzxx513@gmail.com>.
|
* Copyright © 2017 Xiao Zhang <zzxx513@gmail.com>. |
testservice/gen
Code generated by turbo.
|
Code generated by turbo. |
testservice/gen/proto
Package proto is a generated protocol buffer package.
|
Package proto is a generated protocol buffer package. |
* Copyright © 2017 Xiao Zhang <zzxx513@gmail.com>.
|
* Copyright © 2017 Xiao Zhang <zzxx513@gmail.com>. |
cmd
* Copyright © 2017 Xiao Zhang <zzxx513@gmail.com>.
|
* Copyright © 2017 Xiao Zhang <zzxx513@gmail.com>. |