aphgrpc

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2019 License: BSD-2-Clause Imports: 12 Imported by: 5

README

aphgrpc

License
GoDoc Latest release
Technical debt Issues Maintainability Dependabot Status
Issues Open Issues Closed Issues
Total PRS Open PRS Closed PRS Merged PRS
Commits Last commit Branches Tags Latest tag
GitHub repo size GitHub code size in bytes Lines of Code
Funding Funding

Package aphgrpc provides various interfaces, functions, types for building and working with gRPC services.

Documentation

Overview

Package aphgrpc provides various interfaces, functions, types for building and working with gRPC services.

Index

Constants

View Source
const (
	// MetaKey is the key used for storing all metadata
	MetaKey = "error"
)

Variables

View Source
var (
	//ErrDatabaseQuery represents database query related errors
	ErrDatabaseQuery = newError("Database query error")
	//ErrDatabaseInsert represents database insert related errors
	ErrDatabaseInsert = newError("Database insert error")
	//ErrDatabaseUpdate represents database update related errors
	ErrDatabaseUpdate = newError("Database update error")
	//ErrDatabaseDelete represents database update delete errors
	ErrDatabaseDelete = newError("Database delete error")
	//ErrNotFound represents the absence of an HTTP resource
	ErrNotFound = newError("Resource not found")
	//ErrExists represents the presence of an HTTP resource
	ErrExists = newError("Resource already exists")
	//ErrJSONEncoding represents any json encoding error
	ErrJSONEncoding = newError("Json encoding error")
	//ErrStructMarshal represents any error with marshalling structure
	ErrStructMarshal = newError("Structure marshalling error")
	//ErrIncludeParam represents any error with invalid include query parameter
	ErrIncludeParam = newErrorWithParam("Invalid include query parameter", "include")
	//ErrSparseFieldSets represents any error with invalid sparse fieldsets query parameter
	ErrFields = newErrorWithParam("Invalid field query parameter", "field")
	//ErrFilterParam represents any error with invalid filter query paramter
	ErrFilterParam = newErrorWithParam("Invalid filter query parameter", "filter")
	//ErrNotAcceptable represents any error with wrong or inappropriate http Accept header
	ErrNotAcceptable = newError("Accept header is not acceptable")
	//ErrUnsupportedMedia represents any error with unsupported media type in http header
	ErrUnsupportedMedia = newError("Media type is not supported")
	//ErrInValidParam represents any error with validating input parameters
	ErrInValidParam = newError("Invalid parameters")
	//ErrRetrieveMetadata represents any error to retrieve grpc metadata from the running context
	ErrRetrieveMetadata = errors.New("unable to retrieve metadata")
	//ErrXForwardedHost represents any failure or absence of x-forwarded-host HTTP header in the grpc context
	ErrXForwardedHost = errors.New("x-forwarded-host header is absent")
)

Functions

func AssignFieldsToStructs

func AssignFieldsToStructs(from interface{}, to interface{})

AssignFieldsToStructs copy fields value between structure

func CheckNoRows

func CheckNoRows(err error) bool

func HandleDeleteError

func HandleDeleteError(ctx context.Context, err error) error

func HandleError

func HandleError(ctx context.Context, err error) error

func HandleExistError

func HandleExistError(ctx context.Context, err error) error

func HandleFilterParamError

func HandleFilterParamError(ctx context.Context, err error) error

func HandleGenericError

func HandleGenericError(ctx context.Context, err error) error

func HandleGetArgError

func HandleGetArgError(ctx context.Context, err error) error

func HandleGetError

func HandleGetError(ctx context.Context, err error) error

func HandleInsertArgError

func HandleInsertArgError(ctx context.Context, err error) error

func HandleInsertError

func HandleInsertError(ctx context.Context, err error) error

func HandleInvalidParamError

func HandleInvalidParamError(ctx context.Context, err error) error

func HandleNotFoundError

func HandleNotFoundError(ctx context.Context, err error) error

func HandleUpdateArgError

func HandleUpdateArgError(ctx context.Context, err error) error

func HandleUpdateError

func HandleUpdateError(ctx context.Context, err error) error

func NatsFlag added in v1.1.0

func NatsFlag() []cli.Flag

NatsFlag returns a cli.Flag slice for using in the command line arguments

func ProtoTimeStamp

func ProtoTimeStamp(ts *timestamp.Timestamp) time.Time

func TimestampProto

func TimestampProto(t time.Time) *timestamp.Timestamp

Types

type Option

type Option func(*ServiceOptions)

func TopicsOption

func TopicsOption(t map[string]string) Option

type Service

type Service struct {
	Resource string
	Context  context.Context
	Topics   map[string]string
}

func (*Service) GetResourceName

func (s *Service) GetResourceName() string

type ServiceOptions

type ServiceOptions struct {
	Topics   map[string]string
	Resource string
}

Jump to

Keyboard shortcuts

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