rpc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package rpc contains all methods and middleware for working gRPC server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeUnaryServerLogger

func MakeUnaryServerLogger(logger *zap.Logger) grpc.UnaryServerInterceptor

MakeUnaryServerLogger returns a new unary server interceptor that contains request logger.

func New

func New(application users, logger *zap.Logger) *grpc.Server

New returns gRPC server configured to listen on the TCP network.

func RegisterUsersServer

func RegisterUsersServer(s *grpc.Server, srv UsersServer)

func UnaryServerAccessLog

func UnaryServerAccessLog(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (_ interface{}, err error)

UnaryServerAccessLog returns a new unary server interceptor that logs request status.

func UnaryServerRecover

func UnaryServerRecover(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (_ interface{}, err error)

UnaryServerRecover returns a new unary server interceptor that recover and logs panic.

Types

type AuthInfo

type AuthInfo struct {
	Token                string   `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*AuthInfo) Descriptor

func (*AuthInfo) Descriptor() ([]byte, []int)

func (*AuthInfo) GetToken

func (m *AuthInfo) GetToken() string

func (*AuthInfo) ProtoMessage

func (*AuthInfo) ProtoMessage()

func (*AuthInfo) Reset

func (m *AuthInfo) Reset()

func (*AuthInfo) String

func (m *AuthInfo) String() string

func (*AuthInfo) XXX_DiscardUnknown

func (m *AuthInfo) XXX_DiscardUnknown()

func (*AuthInfo) XXX_Marshal

func (m *AuthInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AuthInfo) XXX_Merge

func (m *AuthInfo) XXX_Merge(src proto.Message)

func (*AuthInfo) XXX_Size

func (m *AuthInfo) XXX_Size() int

func (*AuthInfo) XXX_Unmarshal

func (m *AuthInfo) XXX_Unmarshal(b []byte) error

type UnimplementedUsersServer

type UnimplementedUsersServer struct {
}

UnimplementedUsersServer can be embedded to have forward compatible implementations.

func (*UnimplementedUsersServer) GetUserByAuthToken

func (*UnimplementedUsersServer) GetUserByAuthToken(ctx context.Context, req *AuthInfo) (*User, error)

type User

type User struct {
	Id                   int32    `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Username             string   `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
	Email                string   `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*User) Descriptor

func (*User) Descriptor() ([]byte, []int)

func (*User) GetEmail

func (m *User) GetEmail() string

func (*User) GetId

func (m *User) GetId() int32

func (*User) GetUsername

func (m *User) GetUsername() string

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) Reset

func (m *User) Reset()

func (*User) String

func (m *User) String() string

func (*User) XXX_DiscardUnknown

func (m *User) XXX_DiscardUnknown()

func (*User) XXX_Marshal

func (m *User) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*User) XXX_Merge

func (m *User) XXX_Merge(src proto.Message)

func (*User) XXX_Size

func (m *User) XXX_Size() int

func (*User) XXX_Unmarshal

func (m *User) XXX_Unmarshal(b []byte) error

type UsersClient

type UsersClient interface {
	GetUserByAuthToken(ctx context.Context, in *AuthInfo, opts ...grpc.CallOption) (*User, error)
}

UsersClient is the client API for Users service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewUsersClient

func NewUsersClient(cc *grpc.ClientConn) UsersClient

type UsersServer

type UsersServer interface {
	GetUserByAuthToken(context.Context, *AuthInfo) (*User, error)
}

UsersServer is the server API for Users service.

Jump to

Keyboard shortcuts

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