interfaces

package
v1.6.13 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2021 License: Apache-2.0 Imports: 12 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACLPermissionChecker added in v1.5.7

type ACLPermissionChecker interface {
	CheckPermission(ctx context.Context, userID string, permissionCode string) (role string, err error)
}

ACLPermissionChecker abstraction for check acl permission with given permission code

type Broker

type Broker interface {
	GetConfiguration(types.Worker) interface{} // get broker configuration (different type for each broker)
	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

	// GRPCPermissionACL method.
	// This middleware required TokenValidator (GRPCBearerAuth middleware must executed before) for extract userID
	// from token (from `Subject` field in token claim payload)
	GRPCPermissionACL(permissionCode string) types.MiddlewareFunc
}

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

	// GraphQLPermissionACL method.
	// This middleware required TokenValidator (GraphQLBearerAuth middleware must executed before) for extract userID
	// from token (from `Subject` field in token claim payload)
	GraphQLPermissionACL(permissionCode string) types.MiddlewareFunc
}

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

	// HTTPPermissionACL method.
	// This middleware required TokenValidator (HTTPBearerAuth middleware must executed before) for extract userID
	// from token (from `Subject` field in token claim payload)
	HTTPPermissionACL(permissionCode string) func(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, args *candishared.PublisherArgument) (err error)
}

Publisher abstract interface

type RESTHandler

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

RESTHandler delivery factory for REST handler (default using echo rest framework)

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 ServerHandler added in v1.6.0

type ServerHandler interface {
	MountHandlers(group interface{}) // why interface? cause every server is different type for grouping route handler
}

ServerHandler delivery factory for all additional server handler (rest framework, p2p, and many more)

type TokenValidator

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

TokenValidator abstract interface for jwt validator

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)
	Log(key string, value interface{})
	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