interfaces

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

type Broker interface {
	GetKafkaClient() sarama.Client
	Publisher(types.Worker) Publisher
	Health() map[string]error
	Closer
}

Broker abstraction

type Cache

type Cache interface {
	Get(ctx context.Context, key string) ([]byte, error)
	GetKeys(ctx context.Context, pattern string) ([]string, error)
	Set(ctx context.Context, key string, value interface{}, expire time.Duration) error
	Exists(ctx context.Context, key string) (bool, error)
	Delete(ctx context.Context, key string) error
}

Cache abstract interface

type Closer

type Closer interface {
	Disconnect(ctx context.Context) error
}

Closer abstraction

type GRPCHandler

type GRPCHandler interface {
	Register(server *grpc.Server, middlewareGroup *types.MiddlewareGroup)
}

GRPCHandler delivery factory for GRPC handler

type GRPCMiddleware

type GRPCMiddleware interface {
	GRPCBasicAuth(ctx context.Context) context.Context
	GRPCBearerAuth(ctx context.Context) context.Context
}

GRPCMiddleware interface, common middleware for grpc handler

type GraphQLHandler

type GraphQLHandler interface {
	Query() interface{}
	Mutation() interface{}
	Subscription() interface{}
	RegisterMiddleware(group *types.MiddlewareGroup)
}

GraphQLHandler delivery factory for GraphQL resolver handler

type GraphQLMiddleware

type GraphQLMiddleware interface {
	GraphQLBasicAuth(ctx context.Context) context.Context
	GraphQLBearerAuth(ctx context.Context) context.Context
}

GraphQLMiddleware interface, common middleware for graphql handler, as directive in graphql schema

type HTTPMiddleware

type HTTPMiddleware interface {
	HTTPBasicAuth(next http.Handler) http.Handler
	HTTPBearerAuth(next http.Handler) http.Handler
	HTTPMultipleAuth(next http.Handler) http.Handler
}

HTTPMiddleware interface, common middleware for http handler

type Middleware

type Middleware interface {
	Basic(ctx context.Context, authKey string) error
	Bearer(ctx context.Context, token string) (*candishared.TokenClaim, error)

	HTTPMiddleware
	GRPCMiddleware
	GraphQLMiddleware
}

Middleware abstraction

type MongoDatabase

type MongoDatabase interface {
	ReadDB() *mongo.Database
	WriteDB() *mongo.Database
	Health() map[string]error
	Closer
}

MongoDatabase abstraction

type Publisher

type Publisher interface {
	PublishMessage(ctx context.Context, topic, key string, message interface{}) (err error)
}

Publisher abstract interface

type RESTHandler added in v1.4.0

type RESTHandler interface {
	Mount(group *echo.Group)
}

RESTHandler delivery factory for REST handler

type RSAKey

type RSAKey interface {
	PrivateKey() *rsa.PrivateKey
	PublicKey() *rsa.PublicKey
}

RSAKey abstraction

type RedisPool

type RedisPool interface {
	ReadPool() *redis.Pool
	WritePool() *redis.Pool
	Health() map[string]error
	Cache() Cache
	Closer
}

RedisPool abstraction

type SQLDatabase

type SQLDatabase interface {
	ReadDB() *sql.DB
	WriteDB() *sql.DB
	Health() map[string]error
	Closer
}

SQLDatabase abstraction

type TokenValidator

type TokenValidator interface {
	ValidateToken(ctx context.Context, token string) (*candishared.TokenClaim, error)
}

TokenValidator abstract interface

type Tracer

type Tracer interface {
	Context() context.Context
	Tags() map[string]interface{}
	SetTag(key string, value interface{})
	InjectHTTPHeader(req *http.Request)
	InjectGRPCMetadata(md metadata.MD)
	SetError(err error)
	Finish(additionalTags ...map[string]interface{})
}

Tracer for trace

type Validator

type Validator interface {
	// ValidateDocument method using jsonschema with input is json source
	ValidateDocument(reference string, document interface{}) error

	// ValidateStruct method, rules from struct tag using github.com/go-playground/validator
	ValidateStruct(data interface{}) error
}

Validator abstract interface

type WorkerHandler

type WorkerHandler interface {
	MountHandlers(group *types.WorkerHandlerGroup)
}

WorkerHandler delivery factory for all worker handler

Jump to

Keyboard shortcuts

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