service

package
v0.0.0-...-da17191 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

README

Service

This is the package where you implement the gRPC services. This should be the glue layer between your business logic and the API.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the API implementation

func New

func New() *Service

New creates a new service

func (*Service) CloseInternalClientConn

func (s *Service) CloseInternalClientConn() error

CloseInternalClientConn closes the internal client connection if we use the RESTMuxViaGRPC() style calls. While this isn't strictly necessary, being able to shut it down will clean things up so unit tests don't complain about leaked goroutines.

func (*Service) Create

func (s *Service) Create(ctx context.Context, sample *apipb.Sample) (*apipb.SampleCreateResponse, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, req *apipb.SampleDeleteRequest) (*empty.Empty, error)

func (*Service) GRPCServer

func (s *Service) GRPCServer() *grpc.Server

Return a gRPC server instance.

func (*Service) Get

func (*Service) List

func (*Service) RESTMux

func (s *Service) RESTMux(ctx context.Context) (*runtime.ServeMux, error)

RESTMux that uses the service directly. This means requests will not go through interceptors.

func (*Service) RESTMuxViaGRPC

func (s *Service) RESTMuxViaGRPC(ctx context.Context, listenAddr string) (*runtime.ServeMux, error)

RESTMuxViaGRPC creates a mux which uses an internal gRPC client. This has the benefit that REST accesses will go through interceptors.

func (*Service) Update

func (s *Service) Update(ctx context.Context, req *apipb.Sample) (*empty.Empty, error)

Jump to

Keyboard shortcuts

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