aphgrpc

package module
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: BSD-2-Clause Imports: 11 Imported by: 2

README

aphgrpc

License
Go Reference Latest release
Maintainability
Last commit
Funding

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

Misc badges

Issues Open Issues Closed Issues
Total PRS Open PRS Closed PRS Merged PRS
Commits Branches Tags
GitHub repo size GitHub code size in bytes Lines of Code

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")
	//ErrAuthentication represents the absence of valid authentication credentials
	ErrAuthentication = newError("Invalid credentials for authentication")
	//ErrMessagingReply represents any error in request reply messaging
	ErrMessagingReply = newError("messaging reply error")
	//ErrMessagingReq represents any error in request reply messaging
	ErrMessagingReq = newError("messaging request error")
	//ErrMessagingSub represents any error in publish subscribe messaging
	ErrMessagingSub = newError("messaging subscription error")
	//ErrMessagingPub represents any error in publish subscribe messaging
	ErrMessagingPub = newError("messaging publication error")
	//ErrOuthExchange represents any error in exchanging a code for a token with the oauth server
	ErrOauthExchange = newError("Unable to exchange token for code")
	//ErrUserRetrieval represents any error in retrieving user information from an oauth provider
	ErrUserRetrieval = newError("Unable to retrieve user information")
)

Functions

func AssignFieldsToStructs

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

AssignFieldsToStructs copy fields value between structure

func CheckNoRows

func CheckNoRows(err error) bool

func HandleAuthenticationError added in v1.2.0

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

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 HandleJSONEncodingError added in v1.3.0

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

func HandleMessagingPubError added in v1.2.0

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

func HandleMessagingReplyError added in v1.2.0

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

func HandleMessagingReqError added in v1.2.0

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

func HandleMessagingSubError added in v1.2.0

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

func HandleNotFoundError

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

func HandleOauthExchangeError added in v1.2.0

func HandleOauthExchangeError(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 HandleUserRetrievalError added in v1.2.0

func HandleUserRetrievalError(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 *timestamppb.Timestamp) time.Time

func TimestampProto

func TimestampProto(t time.Time) *timestamppb.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
	Params   map[string]string
}

func (*Service) GetResourceName

func (s *Service) GetResourceName() string

type ServiceOptions

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

Jump to

Keyboard shortcuts

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