Documentation ¶
Overview ¶
Package serv is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterUserHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterUserHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserClient) error
- func RegisterUserHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterUserHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServer) error
- func RegisterUserServer(s *grpc.Server, srv UserServer)
- type UnimplementedUserServer
- type UserClient
- type UserServer
Constants ¶
This section is empty.
Variables ¶
var File_proto_serv_proto protoreflect.FileDescriptor
Functions ¶
func RegisterUserHandler ¶
RegisterUserHandler registers the http handlers for service User to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterUserHandlerClient ¶
RegisterUserHandlerClient registers the http handlers for service User to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "UserClient" to call the correct interceptors.
func RegisterUserHandlerFromEndpoint ¶
func RegisterUserHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterUserHandlerFromEndpoint is same as RegisterUserHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterUserHandlerServer ¶
RegisterUserHandlerServer registers the http handlers for service User to "mux". UnaryRPC :call UserServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterUserHandlerFromEndpoint instead.
func RegisterUserServer ¶
func RegisterUserServer(s *grpc.Server, srv UserServer)
Types ¶
type UnimplementedUserServer ¶
type UnimplementedUserServer struct { }
UnimplementedUserServer can be embedded to have forward compatible implementations.
func (*UnimplementedUserServer) GetList ¶
func (*UnimplementedUserServer) GetList(context.Context, *model.UserSelect) (*model.Users, error)
type UserClient ¶
type UserClient interface { // GetList fetches all users or filters by query parameter ?active=false|true // overcoming false vs empty of a boolean type variant by using string // active=false|true|” - to filter false or true or all // PLUS DEV MODE TESTS: active=dev-db-mockup|dev-db-truncate GetList(ctx context.Context, in *model.UserSelect, opts ...grpc.CallOption) (*model.Users, error) // Del - deletes record by userid // returns deleted record or error message Del(ctx context.Context, in *model.User, opts ...grpc.CallOption) (*model.User, error) // Add - adds user record, require name!=”, field active=true is optional // userid is calculated by db (at save transaction as max value + 1) Add(ctx context.Context, in *model.User, opts ...grpc.CallOption) (*model.User, error) }
UserClient is the client API for User service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewUserClient ¶
func NewUserClient(cc grpc.ClientConnInterface) UserClient
type UserServer ¶
type UserServer interface { // GetList fetches all users or filters by query parameter ?active=false|true // overcoming false vs empty of a boolean type variant by using string // active=false|true|” - to filter false or true or all // PLUS DEV MODE TESTS: active=dev-db-mockup|dev-db-truncate GetList(context.Context, *model.UserSelect) (*model.Users, error) // Del - deletes record by userid // returns deleted record or error message Del(context.Context, *model.User) (*model.User, error) // Add - adds user record, require name!=”, field active=true is optional // userid is calculated by db (at save transaction as max value + 1) Add(context.Context, *model.User) (*model.User, error) }
UserServer is the server API for User service.