types

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConfigNotFound       = NewError("config not found")
	ErrLoggerConfigInvalid  = NewError("config invalid")
	ErrConfigInvalidPath    = NewError("config invalid path")
	ErrConfigParseFailed    = NewError("config parse failed")
	ErrConfigIsNil          = NewError("config is nil")
	ErrConfigLoadFailed     = NewError("config load failed")
	ErrConfigValidateFailed = NewError("config validate failed")
)
View Source
var (
	ErrServerNotRunning        = NewError("server not running")
	ErrServerAlreadyRunning    = NewError("server already running")
	ErrServerStartFailed       = NewError("server start failed")
	ErrServerStopFailed        = NewError("server stop failed")
	ErrRouteFinalizationFailed = NewError("route finalization failed")
	ErrHandlerIsNil            = NewError("handler is nil")
)
View Source
var (
	ErrMiddlewareNotFound     = NewError("middleware not found")
	ErrMiddlewareInvalidType  = NewError("middleware invalid type")
	ErrMiddlewareOrderInvalid = NewError("middleware order invalid")
	ErrAuthTokenInvalid       = NewError("auth token invalid")
	ErrBodyTooLarge           = NewError("body too large")
	ErrRateLimitExceeded      = NewError("rate limit exceeded")
)
View Source
var (
	ErrCacheNotFound         = NewError("cache not found")
	ErrCacheKeyEmpty         = NewError("cache key empty")
	ErrCacheConnectionFailed = NewError("cache connection failed")
	ErrCacheTypeUnknown      = NewError("cache type unknown")
	ErrCacheOperationFailed  = NewError("cache operation failed")
	ErrCacheIsDisabled       = NewError("cache manager is disabled")
)
View Source
var (
	ErrDatabaseNotFound         = NewError("database not found")
	ErrDatabaseConnectionFailed = NewError("database connection failed")
	ErrDatabaseTypeUnknown      = NewError("database type unknown")
	ErrDatabaseOperationFailed  = NewError("database operation failed")
	ErrDatabaseIsDisabled       = NewError("database manager is disabled")
	ErrDatabaseCollectionExists = NewError("database collection exists")
	ErrDatabaseDocumentNotFound = NewError("database document not found")
)
View Source
var (
	ErrActionNotInitialized   = NewError("action not initialized")
	ErrActionPublishFailed    = NewError("action publish failed")
	ErrActionConnectionFailed = NewError("action connection failed")
	ErrActionConfigInvalid    = NewError("action config invalid")
	ErrActionTypeUnknown      = NewError("action type unknown")
	ErrActionIsDisabled       = NewError("action broker is disabled")
	ErrActionIsRunning        = NewError("action is running")
)
View Source
var (
	ErrCronJobNotFound       = NewError("cron job not found")
	ErrCronIsRunning         = NewError("cron is running")
	ErrCronSchedulerStopped  = NewError("cron scheduler stopped")
	ErrCronJobExists         = NewError("cron job exists")
	ErrCronExpressionInvalid = NewError("cron expression invalid")
	ErrCronJobFailed         = NewError("cron job failed")
	ErrCronJobNameIsEmpty    = NewError("cron job name is empty")
	ErrCronJobIsNil          = NewError("cron job is nil")
	ErrCronJobTimeout        = NewError("cron job timeout")
)
View Source
var (
	ErrMetricsNotRunning     = NewError("metrics manager not running")
	ErrMetricsTypeUnknown    = NewError("metrics type unknown")
	ErrMetricsStartFailed    = NewError("metrics start failed")
	ErrMetricsConfigInvalid  = NewError("metrics config invalid")
	ErrMetricsIsDisabled     = NewError("metrics manager is disabled")
	ErrTemplateFailed        = NewError("metrics manager template build failed")
	ErrMetricsGetFailed      = NewError("metrics manager get failed")
	ErrMetricsStatsGetFailed = NewError("metrics manager stats get failed")
)
View Source
var (
	ErrClientNotFound        = NewError("client not found")
	ErrClientCreateFailed    = NewError("client create failed")
	ErrClientRequestFailed   = NewError("client request failed")
	ErrClientResponseInvalid = NewError("client response invalid")
	ErrClientTimeout         = NewError("client timeout")
	ErrCircuitBreakerOpen    = NewError("circuit breaker open")
)
View Source
var (
	ErrHealthIsNotRunning = NewError("health manager is not running")
	ErrHealthCheckFailed  = NewError("health check failed")
	ErrHealthCheckTimeout = NewError("health check timeout")
)
View Source
var (
	ErrDocsIsNotRunning   = NewError("documentation manager is not running")
	ErrDocsGenerateFailed = NewError("documentation generation failed")
)
View Source
var (
	ErrLogFileIsEmpty     = NewError("log file is empty")
	ErrLogFileWrongFormat = NewError("log file wrong format")
	ErrLoggerTypeUnknown  = NewError("logger type unknown")
)
View Source
var (
	ErrServiceIsRunning     = NewError("service is running")
	ErrServiceIsNotRunning  = NewError("service is not running")
	ErrComponentNotFound    = NewError("component not found")
	ErrComponentStartFailed = NewError("component start failed")
	ErrComponentStopFailed  = NewError("component stop failed")
)
View Source
var (
	ErrInvalidParameter = NewError("invalid parameter")
	ErrOperationFailed  = NewError("operation failed")
	ErrNotImplemented   = NewError("not implemented")
	ErrPermissionDenied = NewError("permission denied")
	ErrResourceNotFound = NewError("resource not found")
	ErrInternalError    = NewError("internal error")
	ErrContextCancelled = NewError("context cancelled")
	ErrContextTimeout   = NewError("context timeout")
	ErrInvalidState     = NewError("invalid state")
	ErrNotSupported     = NewError("not supported")
	ErrMarshaling       = NewError("error during marshalling")
	ErrUnMarshaling     = NewError("error during unmarshalling")
	ErrWriteContext     = NewError("error during write context")
	ErrPathNotFound     = NewError("path not found")
)

Functions

func Errorf

func Errorf(baseErr error, format string, args ...interface{}) error

func IsError

func IsError(err, target error) bool

func NewError added in v1.1.1

func NewError(message string) error

func NewErrorf

func NewErrorf(format string, args ...interface{}) error

func WrapError

func WrapError(err error, message string) error

func WrapErrorf added in v1.1.1

func WrapErrorf(err error, format string, args ...interface{}) error

Types

type ActionBroker

type ActionBroker interface {
	Publish(action string, payload interface{}) error
	Subscribe(action string, handler ActionHandler) error
	Unsubscribe(action string) error
}

type ActionBrokerCreator

type ActionBrokerCreator func(config interface{}) (ActionBroker, error)

type ActionHandler

type ActionHandler func(payload *ActionMessage) error

type ActionMessage

type ActionMessage struct {
	Action    string            `json:"action"`
	Payload   interface{}       `json:"payload"`
	Timestamp time.Time         `json:"timestamp"`
	Source    string            `json:"source"`
	Metadata  map[string]string `json:"metadata"`
	MessageID string            `json:"message_id"`
}

type ActionsConfig

type ActionsConfig struct {
	Enabled  bool                   `yaml:"enabled" json:"enabled"`
	Broker   *BrokerConfig          `yaml:"broker" json:"broker"`
	Webhooks *WebhooksConfig        `yaml:"webhooks" json:"webhooks"`
	Events   map[string]EventSchema `yaml:"events" json:"events"`
}

type AuthProvider

type AuthProvider interface {
	Type() string
	ApplyToIncomingRequest(ctx *RequestCtx) error
	ApplyToOutgoingRequest(req *fasthttp.Request, authConfig *ServiceAuthConfig) error
}

type AuthProviderItemConfig

type AuthProviderItemConfig struct {
	Params map[string]interface{} `yaml:"params" json:"params"`
}

type AuthProviderManager

type AuthProviderManager interface {
	Register(name string, provider AuthProvider) error
}

type AuthProvidersConfig

type AuthProvidersConfig struct {
	Token *AuthProviderItemConfig `json:"token" yaml:"token"`
	Basic *AuthProviderItemConfig `json:"basic" yaml:"basic"`
}

type BrokerConfig

type BrokerConfig struct {
	Enabled bool        `yaml:"enabled" json:"enabled"`
	Type    string      `yaml:"type" json:"type"`
	Config  interface{} `yaml:"config" json:"config"`
}

type CacheConfig

type CacheConfig struct {
	Enabled    bool          `yaml:"enabled" json:"enabled"`
	Type       string        `yaml:"type" json:"type" validate:"required_if=Enabled true"`
	Config     interface{}   `yaml:"config" json:"config"`
	DefaultTTL time.Duration `yaml:"default_ttl" json:"default_ttl" validate:"min=0"`
}

type CacheEntry

type CacheEntry struct {
	Key          string            `json:"key"`
	Value        interface{}       `json:"value"`
	TTL          time.Duration     `json:"ttl"`
	CreatedAt    time.Time         `json:"created_at"`
	ExpiresAt    time.Time         `json:"expires_at"`
	Dependencies []string          `json:"dependencies"`
	Metadata     map[string]string `json:"metadata"`
}

type CacheHandlerConfig

type CacheHandlerConfig struct {
	Enabled bool          `validate:"required"`
	Key     string        `validate:"required,min=1"`
	TTL     time.Duration `validate:"min=0"`
	Deps    []string      `validate:"dive,min=1"`
}

type CacheManager

type CacheManager interface {
	LifecycleManager
	Get(key string) (interface{}, bool)
	Set(key string, value interface{}, ttl time.Duration) error
	Delete(key string) error
	Invalidate(keys ...string) error
	GetRevision(key string) uint64
	SetRevision(key string, revision uint64)
	BuildCacheKey(requestPath []byte, dependencies []string, metadata map[string][]byte) string
}

type CacheManagerCreator

type CacheManagerCreator func(config interface{}) (CacheManager, error)

type CallOptions

type CallOptions struct {
	Threshold int
	Timeout   time.Duration
	Retry     int
	Headers   map[string]string
}

type CertificateStatus

type CertificateStatus struct {
	Domain          string    `json:"domain"`
	Status          string    `json:"status"`
	Issuer          string    `json:"issuer,omitempty"`
	Subject         string    `json:"subject,omitempty"`
	NotBefore       time.Time `json:"not_before,omitempty"`
	NotAfter        time.Time `json:"not_after,omitempty"`
	DaysUntilExpiry int       `json:"days_until_expiry,omitempty"`
	Error           string    `json:"error,omitempty"`
}

type CircuitBreakerConfig

type CircuitBreakerConfig struct {
	Enabled          bool          `yaml:"enabled" json:"enabled"`
	FailureThreshold int           `yaml:"failure_threshold" json:"failure_threshold"`
	RecoveryTimeout  time.Duration `yaml:"recovery_timeout" json:"recovery_timeout"`
	HalfOpenRequests int           `yaml:"half_open_requests" json:"half_open_requests"`
}

type ClientManager

type ClientManager interface {
	Call(serviceName, method, path string, data interface{}, opts *CallOptions) ([]byte, int, error)
}

type ClientsConfig added in v1.1.1

type ClientsConfig struct {
	Enabled            bool                            `yaml:"enabled" json:"enabled"`
	DefaultTimeout     time.Duration                   `yaml:"default_timeout" json:"default_timeout"`
	MaxIdleConnections int                             `yaml:"max_idle_connections" json:"max_idle_connections"`
	IdleConnTimeout    time.Duration                   `yaml:"idle_conn_timeout" json:"idle_conn_timeout"`
	DefaultRetries     int                             `yaml:"default_retries" json:"default_retries"`
	CircuitBreaker     *CircuitBreakerConfig           `yaml:"circuit_breaker" json:"circuit_breaker"`
	Services           map[string]*ServiceClientConfig `yaml:"services" json:"services"`
}

type ConfigManager

type ConfigManager interface {
	GetConfig() *ServiceConfig
	GetValue(path string, defaultValue interface{}) interface{}
	GetAs(path string, target interface{}) error
}

type Counter

type Counter interface {
	Inc()
	Add(value float64)
	Get() float64
}

type CreateDocumentsRequest added in v1.1.2

type CreateDocumentsRequest struct {
	Collection string        `json:"collection"`
	Data       []interface{} `json:"data"`
}

type CronConfig

type CronConfig struct {
	Enabled  bool   `yaml:"enabled" json:"enabled"`
	Timezone string `yaml:"timezone" json:"timezone" validate:"required_if=Enabled true"`
}

type CronManager

type CronManager interface {
	Add(jobName, spec string, job func()) error
}

type DatabaseConfig added in v1.1.2

type DatabaseConfig struct {
	Enabled bool   `yaml:"enabled" json:"enabled"`
	Type    string `yaml:"type" json:"type" validate:"required_if=Enabled true"`
	Path    string `yaml:"path" json:"path"`
}

type DatabaseManager added in v1.1.2

type DatabaseManager interface {
	LifecycleManager
	CreateDocuments(ctx context.Context, request CreateDocumentsRequest) ([]string, error)
	ReadDocuments(ctx context.Context, request ReadDocumentsRequest) ([]map[string]interface{}, int64, error)
	UpdateDocuments(ctx context.Context, request UpdateDocumentsRequest) (int64, error)
	DeleteDocuments(ctx context.Context, request DeleteDocumentsRequest) (int64, error)
	CreateCollection(collectionName string) error
	DropCollection(collectionName string) error
}

type DatabaseManagerCreator added in v1.1.2

type DatabaseManagerCreator func(*DatabaseConfig) (DatabaseManager, error)

type DeleteDocumentsRequest added in v1.1.2

type DeleteDocumentsRequest struct {
	Collection string                 `json:"collection"`
	Filter     map[string]interface{} `json:"filter"`
}

type Dispatcher

type Dispatcher interface {
	ActionBroker
}

type DocConfig

type DocConfig struct {
	Path            string
	Method          string
	DocTitle        string
	DocDescription  string
	DocTag          string
	DocRequestType  reflect.Type
	DocResponseType reflect.Type
}

type DocsConfig

type DocsConfig struct {
	Enabled bool   `yaml:"enabled" json:"enabled"`
	Path    string `yaml:"path" json:"path" validate:"required_if=Enabled true"`
}

type DocumentationManager

type DocumentationManager interface {
	LifecycleManager
}

type ErrorResponse added in v1.1.1

type ErrorResponse struct {
	Error   string `json:"error,omitempty"`
	Message string `json:"message,omitempty"`
}

type EventSchema

type EventSchema struct {
	Fields map[string]string `yaml:",inline" json:",inline"`
}

type FastHTTPHandler

type FastHTTPHandler func(ctx *RequestCtx)

type FastResponseWriter

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

func NewFastResponseWriter

func NewFastResponseWriter(ctx *RequestCtx) *FastResponseWriter

func (*FastResponseWriter) Header

func (frw *FastResponseWriter) Header() http.Header

func (*FastResponseWriter) Write

func (frw *FastResponseWriter) Write(data []byte) (int, error)

func (*FastResponseWriter) WriteHeader

func (frw *FastResponseWriter) WriteHeader(statusCode int)

type Gauge

type Gauge interface {
	Set(value float64)
	Inc()
	Dec()
	Add(value float64)
	Sub(value float64)
	Get() float64
}

type GroupBuilder

type GroupBuilder interface {
	WithCache(key string, ttl time.Duration, dependencies ...string) GroupBuilder
	WithMiddlewares(names ...string) GroupBuilder
	WithoutMiddlewares(names ...string) GroupBuilder
	WithTimeout(duration time.Duration) GroupBuilder
	Route(method, path string, handler FastHTTPHandler) RouteBuilder
	GET(path string, handler FastHTTPHandler) RouteBuilder
	POST(path string, handler FastHTTPHandler) RouteBuilder
	PATCH(path string, handler FastHTTPHandler) RouteBuilder
	PUT(path string, handler FastHTTPHandler) RouteBuilder
	DELETE(path string, handler FastHTTPHandler) RouteBuilder
	Group(prefix string) GroupBuilder
}

type HTTPConfig

type HTTPConfig struct {
	Host            string `yaml:"host" json:"host"`
	Port            int    `yaml:"port" json:"port" validate:"min=1,max=65535"`
	ReadTimeout     int    `yaml:"read_timeout" json:"read_timeout"`
	WriteTimeout    int    `yaml:"write_timeout" json:"write_timeout"`
	IdleTimeout     int    `yaml:"idle_timeout" json:"idle_timeout"`
	ShutdownTimeout int    `yaml:"shutdown_timeout" json:"shutdown_timeout"`
}

type HTTPRouter

type HTTPRouter interface {
	Add(method, path string, handler FastHTTPHandler, config *RouteConfig)
	Group(prefix string) GroupBuilder
	GET(path string, handler FastHTTPHandler) RouteBuilder
	POST(path string, handler FastHTTPHandler) RouteBuilder
	PUT(path string, handler FastHTTPHandler) RouteBuilder
	DELETE(path string, handler FastHTTPHandler) RouteBuilder
	GetAllRoutes() map[string]*RouteInfo
}

type HTTPServer

type HTTPServer interface {
	LifecycleManager
}

type HealthCheck

type HealthCheck struct {
	Name      string                 `json:"name"`
	Status    HealthStatus           `json:"status"`
	Message   string                 `json:"message,omitempty"`
	LastCheck time.Time              `json:"last_check"`
	Duration  time.Duration          `json:"duration"`
	Details   map[string]interface{} `json:"details,omitempty"`
}

type HealthChecker

type HealthChecker func(ctx context.Context) HealthCheck

type HealthConfig

type HealthConfig struct {
	Enabled bool `yaml:"enabled" json:"enabled"`
}

type HealthManager

type HealthManager interface {
	LifecycleManager
	RegisterChecker(name string, checker HealthChecker)
	Check(ctx context.Context) HealthReport
}

type HealthReport

type HealthReport struct {
	Status    HealthStatus           `json:"status"`
	Timestamp time.Time              `json:"timestamp"`
	Uptime    time.Duration          `json:"uptime"`
	Service   ServiceInfo            `json:"service"`
	Checks    map[string]HealthCheck `json:"checks"`
	Summary   HealthSummary          `json:"summary"`
}

type HealthStatus

type HealthStatus string
const (
	StatusHealthy   HealthStatus = "healthy"
	StatusUnhealthy HealthStatus = "unhealthy"
	StatusUnknown   HealthStatus = "unknown"
)

type HealthSummary

type HealthSummary struct {
	Total     int `json:"total"`
	Healthy   int `json:"healthy"`
	Unhealthy int `json:"unhealthy"`
	Unknown   int `json:"unknown"`
}

type Histogram

type Histogram interface {
	Observe(value float64)
	ObserveDuration(start time.Time)
	GetCount() uint64
	GetSum() float64
}

type JobEntry

type JobEntry struct {
	ID            cron.EntryID
	Name          string
	Spec          string
	Job           func()
	Timeout       time.Duration
	AddedAt       time.Time
	LastRun       time.Time
	NextRun       time.Time
	LastDuration  time.Duration
	TotalDuration time.Duration
	AvgDuration   time.Duration
	RunCount      int64
	Error         error
}

type LifecycleManager

type LifecycleManager interface {
	Start() error
	Stop() error
	IsRunning() bool
}

type Logger

type Logger interface {
	Error(msg string, fields ...zap.Field)
	ErrorWithErrStack(msg string, err error, fields ...zap.Field)
	ErrorWithStack(msg string, stack string, fields ...zap.Field)
	Warn(msg string, fields ...zap.Field)
	Info(msg string, fields ...zap.Field)
	Debug(msg string, fields ...zap.Field)
	Log(lvl zapcore.Level, msg string, fields ...zap.Field)
}

type LoggerConfig

type LoggerConfig struct {
	Type   string      `yaml:"type" json:"type"`
	Level  string      `yaml:"level" json:"level" validate:"required_if=Enabled true"`
	Config interface{} `yaml:"config" json:"config"`
}

type LoggerCreator

type LoggerCreator func(config interface{}) (Logger, error)

type LoggerManager

type LoggerManager interface {
	Logger
}

type MetricValue

type MetricValue struct {
	Name      string            `json:"name"`
	Type      string            `json:"type"`
	Value     float64           `json:"value"`
	Labels    map[string]string `json:"labels"`
	Timestamp time.Time         `json:"timestamp"`
	Help      string            `json:"help"`
}

type MetricsCollectorConfig

type MetricsCollectorConfig struct {
	System     bool `yaml:"system" json:"system"`
	Runtime    bool `yaml:"runtime" json:"runtime"`
	HTTP       bool `yaml:"http" json:"http"`
	Cache      bool `yaml:"cache" json:"cache"`
	Middleware bool `yaml:"middleware" json:"middleware"`
}

type MetricsConfig

type MetricsConfig struct {
	Enabled    bool                   `yaml:"enabled" json:"enabled"`
	Type       string                 `yaml:"type" json:"type" validate:"required_if=Enabled true"`
	Config     interface{}            `yaml:"config" json:"config"`
	Prefix     string                 `yaml:"prefix" json:"prefix"`
	Labels     map[string]string      `yaml:"labels" json:"labels"`
	HTTP       MetricsHTTPConfig      `yaml:"http" json:"http"`
	Collectors MetricsCollectorConfig `yaml:"collectors" json:"collectors"`
}

type MetricsHTTPConfig

type MetricsHTTPConfig struct {
	Enabled bool   `yaml:"enabled" json:"enabled"`
	Path    string `yaml:"path" json:"path"`
	Port    int    `yaml:"port" json:"port"`
}

type MetricsManager

type MetricsManager interface {
	LifecycleManager
	Counter(name string, labels map[string]string) Counter
	Gauge(name string, labels map[string]string) Gauge
	Histogram(name string, buckets []float64, labels map[string]string) Histogram
	Summary(name string, objectives map[float64]float64, labels map[string]string) Summary
	RegisterSystemMetrics() error
	StartSystemCollection() error
	StopSystemCollection() error
	GetMetrics() ([]byte, error)
	GetStats() ([]byte, error)
}

type MetricsManagerCreator

type MetricsManagerCreator func(config interface{}) (MetricsManager, error)

type MetricsStats

type MetricsStats struct {
	TotalMetrics     int                    `json:"total_metrics"`
	CounterMetrics   int                    `json:"counter_metrics"`
	GaugeMetrics     int                    `json:"gauge_metrics"`
	HistogramMetrics int                    `json:"histogram_metrics"`
	SummaryMetrics   int                    `json:"summary_metrics"`
	Labels           map[string]int         `json:"labels"`
	LastUpdate       time.Time              `json:"last_update"`
	MemoryUsage      int64                  `json:"memory_usage"`
	Collections      uint64                 `json:"collections"`
	Errors           uint64                 `json:"errors"`
	Details          map[string]interface{} `json:"details"`
}

type Middleware

type Middleware interface {
	Handle(ctx *RequestCtx, next func(*RequestCtx), config *RouteConfig)
	Name() string
	Weight() int
}

type MiddlewareEntry

type MiddlewareEntry struct {
	Name       string
	Middleware Middleware
	Weight     int
}

type MiddlewareItemConfig

type MiddlewareItemConfig struct {
	Enabled bool                   `yaml:"enabled" json:"enabled"`
	Weight  int                    `yaml:"weight" json:"weight" validate:"min=0"`
	Params  map[string]interface{} `yaml:"params" json:"params"`
}

type MiddlewareManager

type MiddlewareManager interface {
	LifecycleManager
	Register(middleware Middleware) error
	Execute(ctx *RequestCtx, handler func(*RequestCtx), config *RouteConfig)
}

type MiddlewaresConfig

type MiddlewaresConfig struct {
	Enabled     bool                  `yaml:"enabled" json:"enabled"`
	Auth        *MiddlewareItemConfig `yaml:"auth" json:"auth"`
	Metadata    *MiddlewareItemConfig `yaml:"metadata" json:"metadata"`
	Logging     *MiddlewareItemConfig `yaml:"logging" json:"logging"`
	Cache       *MiddlewareItemConfig `yaml:"cache" json:"cache"`
	Recovery    *MiddlewareItemConfig `yaml:"recovery" json:"recovery"`
	Compression *MiddlewareItemConfig `yaml:"compression" json:"compression"`
	CORS        *MiddlewareItemConfig `yaml:"cors" json:"cors"`
	RateLimit   *MiddlewareItemConfig `yaml:"rate_limit" json:"rate_limit"`
	BodyLimit   *MiddlewareItemConfig `yaml:"body_limit" json:"body_limit"`
}

type OpenAPISpec

type OpenAPISpec struct {
	OpenAPI    string                    `json:"openapi"`
	Info       SpecInfo                  `json:"info"`
	Servers    []SpecServer              `json:"servers"`
	Paths      map[string]*RoutePathItem `json:"paths"`
	Components *SpecComponents           `json:"components"`
	Tags       []string                  `json:"tags"`
}

type ReadDocumentsRequest added in v1.1.2

type ReadDocumentsRequest struct {
	Collection string                 `json:"collection" validate:"required"`
	Filter     map[string]interface{} `json:"filter,omitempty"`
	Sort       map[string]int         `json:"sort,omitempty"`
	Limit      int                    `json:"limit,omitempty"`
	Skip       int                    `json:"skip,omitempty"`
}

type RequestCtx

type RequestCtx struct {
	*fasthttp.RequestCtx
}

func (*RequestCtx) Error added in v1.1.1

func (ctx *RequestCtx) Error(err error, statusCode int)

func (*RequestCtx) Marshal added in v1.1.1

func (ctx *RequestCtx) Marshal(data any) ([]byte, error)

func (*RequestCtx) ReadJSON

func (ctx *RequestCtx) ReadJSON(request any) error

func (*RequestCtx) Success added in v1.1.1

func (ctx *RequestCtx) Success(data []byte, header []byte) (int, error)

func (*RequestCtx) SuccessJSON added in v1.1.1

func (ctx *RequestCtx) SuccessJSON(data any) (int, error)

func (*RequestCtx) Unmarshal added in v1.1.1

func (ctx *RequestCtx) Unmarshal(data []byte, request any) error

type RouteBuilder

type RouteBuilder interface {
	WithCache(key string, ttl time.Duration, dependencies ...string) RouteBuilder
	WithMiddlewares(names ...string) RouteBuilder
	WithoutMiddlewares(names ...string) RouteBuilder
	WithTimeout(duration time.Duration) RouteBuilder
	WithDoc(title, description, tag string, requestType, responseType interface{}) RouteBuilder
}

type RouteConfig

type RouteConfig struct {
	Cache               *CacheHandlerConfig
	Middlewares         []string
	DisabledMiddlewares []string
	Timeout             time.Duration
	Doc                 *DocConfig
}

type RouteDefinition

type RouteDefinition struct {
	Method  string
	Path    string
	Handler FastHTTPHandler
	Config  *RouteConfig
}

type RouteDocumentation

type RouteDocumentation struct {
	Method       string
	Path         string
	Title        string
	Description  string
	Tags         []string
	RequestType  reflect.Type
	ResponseType reflect.Type
	CreatedAt    time.Time
}

type RouteInfo

type RouteInfo struct {
	Handler FastHTTPHandler
	Config  *RouteConfig
}

type RouteMediaType

type RouteMediaType struct {
	Schema  *RouteSchema `json:"schema,omitempty"`
	Example interface{}  `json:"example,omitempty"`
}

type RouteOperation

type RouteOperation struct {
	Summary     string                    `json:"summary,omitempty"`
	Description string                    `json:"description,omitempty"`
	Tags        []string                  `json:"tags,omitempty"`
	Parameters  []RouteParameter          `json:"parameters,omitempty"`
	RequestBody *RouteRequestBody         `json:"requestBody,omitempty"`
	Responses   map[string]*RouteResponse `json:"responses"`
	Security    []map[string][]string     `json:"security,omitempty"`
}

type RouteParameter

type RouteParameter struct {
	Name        string       `json:"name"`
	In          string       `json:"in"`
	Required    bool         `json:"required,omitempty"`
	Description string       `json:"description,omitempty"`
	Schema      *RouteSchema `json:"schema,omitempty"`
	Example     interface{}  `json:"example,omitempty"`
}

type RoutePathItem

type RoutePathItem struct {
	Get    *RouteOperation `json:"get,omitempty"`
	Post   *RouteOperation `json:"post,omitempty"`
	Put    *RouteOperation `json:"put,omitempty"`
	Delete *RouteOperation `json:"delete,omitempty"`
	Patch  *RouteOperation `json:"patch,omitempty"`
}

type RouteRequestBody

type RouteRequestBody struct {
	Description string                     `json:"description,omitempty"`
	Content     map[string]*RouteMediaType `json:"content"`
	Required    bool                       `json:"required,omitempty"`
}

type RouteResponse

type RouteResponse struct {
	Description string                     `json:"description"`
	Content     map[string]*RouteMediaType `json:"content,omitempty"`
}

type RouteSchema

type RouteSchema struct {
	Type        string                  `json:"type,omitempty"`
	Format      string                  `json:"format,omitempty"`
	Description string                  `json:"description,omitempty"`
	Properties  map[string]*RouteSchema `json:"properties,omitempty"`
	Required    []string                `json:"required,omitempty"`
	Items       *RouteSchema            `json:"items,omitempty"`
	Example     interface{}             `json:"example,omitempty"`
	Enum        []interface{}           `json:"enum,omitempty"`
	Minimum     *float64                `json:"minimum,omitempty"`
	Maximum     *float64                `json:"maximum,omitempty"`
	MinLength   *int                    `json:"minLength,omitempty"`
	MaxLength   *int                    `json:"maxLength,omitempty"`
}

type RouteSecurityScheme

type RouteSecurityScheme struct {
	Type         string `json:"type"`
	Description  string `json:"description,omitempty"`
	Name         string `json:"name,omitempty"`
	In           string `json:"in,omitempty"`
	Scheme       string `json:"scheme,omitempty"`
	BearerFormat string `json:"bearerFormat,omitempty"`
}

type ServerConfig

type ServerConfig struct {
	HTTP *HTTPConfig `yaml:"http" json:"http"`
	TLS  *TLSConfig  `yaml:"tls" json:"tls"`
}

type ServiceAuthConfig

type ServiceAuthConfig struct {
	Provider string                 `yaml:"provider" json:"provider"`
	Payload  map[string]interface{} `yaml:"payload" json:"payload"`
}

type ServiceClientConfig

type ServiceClientConfig struct {
	Url    string             `yaml:"url" json:"url" validate:"required"`
	Auth   *ServiceAuthConfig `yaml:"auth" json:"auth"`
	Events []string           `yaml:"events" json:"events"`
}

type ServiceConfig

type ServiceConfig struct {
	Name          string               `yaml:"name" json:"name" validate:"required"`
	Version       string               `yaml:"version" json:"version" validate:"required"`
	Server        *ServerConfig        `yaml:"server" json:"server"`
	Logger        *LoggerConfig        `yaml:"logger" json:"logger"`
	Cache         *CacheConfig         `yaml:"cache" json:"cache"`
	Database      *DatabaseConfig      `yaml:"database" json:"database"`
	Actions       *ActionsConfig       `yaml:"actions" json:"actions"`
	Cron          *CronConfig          `yaml:"cron" json:"cron"`
	AuthProviders *AuthProvidersConfig `yaml:"auth_providers" json:"auth_providers"`
	Middlewares   *MiddlewaresConfig   `yaml:"middlewares" json:"middlewares"`
	Docs          *DocsConfig          `yaml:"docs" json:"docs"`
	Metrics       *MetricsConfig       `yaml:"metrics" json:"metrics"`
	Clients       *ClientsConfig       `yaml:"clients" json:"clients"`
	Health        *HealthConfig        `yaml:"health" json:"health"`
}

type ServiceInfo

type ServiceInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Host    string `json:"host"`
	Port    int    `json:"port"`
}

type SpecComponents

type SpecComponents struct {
	Schemas         map[string]*RouteSchema         `json:"schemas,omitempty"`
	SecuritySchemes map[string]*RouteSecurityScheme `json:"securitySchemes,omitempty"`
}

type SpecInfo

type SpecInfo struct {
	Title       string `json:"title"`
	Version     string `json:"version"`
	Description string `json:"description"`
}

type SpecServer

type SpecServer struct {
	URL         string `json:"url"`
	Description string `json:"description"`
}

type Summary

type Summary interface {
	Observe(value float64)
	ObserveDuration(start time.Time)
	GetCount() uint64
	GetSum() float64
}

type TLSConfig

type TLSConfig struct {
	Enabled       bool     `yaml:"enabled" json:"enabled"`
	CertFile      string   `yaml:"cert_file,omitempty" json:"cert_file,omitempty"`
	KeyFile       string   `yaml:"key_file,omitempty" json:"key_file,omitempty"`
	AutoCert      bool     `yaml:"auto_cert" json:"auto_cert"`
	Domains       []string `yaml:"domains,omitempty" json:"domains,omitempty"`
	Email         string   `yaml:"email,omitempty" json:"email,omitempty"`
	CacheDir      string   `yaml:"cache_dir,omitempty" json:"cache_dir,omitempty"`
	ACMEDirectory string   `yaml:"acme_directory,omitempty" json:"acme_directory,omitempty"`
}

type TLSManager

type TLSManager interface {
	LifecycleManager
	Serve(addr string) (net.Listener, error)
	GetTLSConfig() *tls.Config
	GetCertificateStatus() map[string]CertificateStatus
}

type UpdateDocumentsRequest added in v1.1.2

type UpdateDocumentsRequest struct {
	Collection string                 `json:"collection"`
	Filter     map[string]interface{} `json:"filter"`
	Data       interface{}            `json:"data"`
	Upsert     bool                   `json:"upsert,omitempty"`
}

type VersionInfo

type VersionInfo struct {
	Version   string `json:"version"`
	BuildInfo string `json:"build_info"`
}

type WebhooksConfig

type WebhooksConfig struct {
	Enabled bool        `yaml:"enabled" json:"enabled"`
	Config  interface{} `yaml:"config" json:"config"`
}

Jump to

Keyboard shortcuts

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