serv

package
v0.0.0-...-0015e7d Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: Unlicense Imports: 17 Imported by: 0

Documentation

Overview

Package serv is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_proto_serv_proto protoreflect.FileDescriptor

Functions

func RegisterUserHandler

func RegisterUserHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterUserHandler registers the http handlers for service User to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterUserHandlerClient

func RegisterUserHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserClient) error

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

func RegisterUserHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServer) error

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) Add

func (*UnimplementedUserServer) Del

func (*UnimplementedUserServer) GetList

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.

Jump to

Keyboard shortcuts

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