Documentation ¶
Index ¶
- func NewClient(conn *grpc.ClientConn, logger log.Logger, options ...kitGRPC.ClientOption) *grpcClient
- func NewPBFromReply(msg *Reply) *pb.Reply
- func NewPBFromRequest(msg *Request) *pb.Request
- type ClientOption
- type ClientRequestFunc
- type ClientResponseFunc
- type Endpoints
- type GRPCServer
- type Reply
- type Repository
- type Request
- type RequestAndStreamHalfDuplex
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(conn *grpc.ClientConn, logger log.Logger, options ...kitGRPC.ClientOption) *grpcClient
func NewPBFromRequest ¶
transformer *Request to *pb.Request
Types ¶
type ClientOption ¶
type ClientOption func(*grpcClient)
func ClientAfter ¶
func ClientAfter(after ...ClientResponseFunc) ClientOption
func ClientBefore ¶
func ClientBefore(before ...ClientRequestFunc) ClientOption
type ClientResponseFunc ¶
type Endpoints ¶
type Endpoints struct { HalfDuplexEndpoint endpoint.Endpoint // half duplex FullDuplexEndpoint endpoint.Endpoint // full duplex }
func MakeEndpoints ¶
func MakeEndpoints(svc Service, mwares []endpoint.Middleware) Endpoints
type GRPCServer ¶
type GRPCServer struct { HalfDuplexGRPCHandler kitGRPC.Handler // TODO : half duplex FullDuplexGRPCHandler kitGRPC.Handler // TODO : full duplex // contains filtered or unexported fields }
func NewGRPCServer ¶
func NewGRPCServer(endpoints Endpoints, logger log.Logger, options ...kitGRPC.ServerOption) (*GRPCServer, error)
func (*GRPCServer) FullDuplex ¶
func (s *GRPCServer) FullDuplex(stream pb.Streams_FullDuplexServer) error
protobuf implementation : full duplex for FullDuplex
func (*GRPCServer) HalfDuplex ¶
func (s *GRPCServer) HalfDuplex(req *pb.Request, stream pb.Streams_HalfDuplexServer) error
protobuf implementation : half duplex for HalfDuplex
type Repository ¶
type Repository interface { HalfDuplex(ctx context.Context, msg string) (string, error) FullDuplex(ctx context.Context, msg string) (string, error) }
*
type MysqlConfig struct { Host string `env:"DB_READ_HOST" envDefault:"local-example"` Port string `env:"DB_READ_PORT" envDefault:"3306"` ConnectionTimeout int `env:"DB_READ_CONNECTION_TIMEOUT" envDefault:"5"` MaxConnLifetime int `env:"DB_READ_MAX_CONN_LIFETIME" envDefault:"0"` MaxIdleConns int `env:"DB_READ_MAX_IDLE_CONNS" envDefault:"2"` MaxOpenConns int `env:"DB_READ_MAX_OPEN_CONNS" envDefault:"0"` ReadTimeout int `env:"DB_READ_READ_TIMEOUT" envDefault:"360"` Username string `env:"DB_READ_USERNAME" envDefault:"root"` Password string `env:"DB_READ_PASSWORD" envDefault:"foobar"` DatabaseName string `env:"DB_READ_DATABASE" envDefault:"example"` }
* *
*
func NewRepository ¶
func NewRepository(logger log.Logger, db interface{}) Repository
type Request ¶
type Request struct {
Msg string
}
func NewRequestFromPB ¶
transformer *pb.Request to *Request
type RequestAndStreamHalfDuplex ¶
type RequestAndStreamHalfDuplex struct { Request *pb.Request Stream pb.Streams_HalfDuplexServer }
request and stream for half duplex
type Service ¶
type Service interface { BroadcastHalfDuplex() chan Reply HalfDuplex(req *pb.Request, stream pb.Streams_HalfDuplexServer) error // half duplex (client request, server streams) BroadcastFullDuplex() chan Reply FullDuplex(stream pb.Streams_FullDuplexServer) error // full duplex (both client and server streams) Log() log.Logger }
func NewService ¶
func NewService(log log.Logger, repo Repository) Service
Click to show internal directories.
Click to hide internal directories.