abstractions

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: Apache-2.0 Imports: 3 Imported by: 1

README

abstractions

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IConfiguration

type IConfiguration interface {
	GetString(key string) string
	GetInt(key string) int
	GetBool(key string) bool

	GetSettings() map[string]any

	SetGetString(fun func(key string) string)
	SetGetBool(fun func(key string) bool)
	SetGetInt(fun func(key string) int)
}

type IExecutor

type IExecutor interface {
	Execute(command string, args ...string) types.CommandResult
	ExecuteInDirectory(directoryPath string, command string, args ...string) types.CommandResult
}

type IHandlersRegistry

type IHandlersRegistry interface {
	AddHandler(
		pattern string,
		hnd func(r *http.Request) (result types.HandlerResult),
	) IHandlersRegistry

	AddProtectedHandler(
		pattern string,
		hnd func(r *http.Request) (result types.HandlerResult),
		roles []string,
	) IHandlersRegistry

	AddMiddleware(
		pos int,
		middleware types.Middleware,
	) IHandlersRegistry

	SetJwtMiddleware(jwt types.JwtMiddleware) IHandlersRegistry

	SetResultFilter(filter types.ResultFilter) IHandlersRegistry

	GetHandler() http.Handler

	GetRoutes() []string

	ClearRoutes()
}

type ILogger

type ILogger interface {
	Log(level types.LogLevel, format string, args ...any)
	LogDebug(format string, args ...any)
	LogInformation(format string, args ...any)
	LogWarning(format string, args ...any)
	LogError(format string, args ...any)
	LogCritical(format string, args ...any)
}

type ILoggerFactory

type ILoggerFactory interface {
	SetWriter(writer io.Writer)
	SetMinLevel(level types.LogLevel)
	SetMinLevelStr(level string) error

	GetWriter() io.Writer
	GetMinLevel() types.LogLevel

	NewLogger(category string) ILogger
}

type IModule

type IModule interface {
	Name() string
	Version() string
	Description() string
	Initialize(
		registry IHandlersRegistry,
		loggerFactory ILoggerFactory,
		executor IExecutor) error
}

type IModulesLoader

type IModulesLoader interface {
	Load(path string) error
	LoadModules() error
	GetLoadedModules() []string
}

type IServer

type IServer interface {
	SetHost(host string)
	SetPort(port int)

	Start()
	Stop()
	WaitForShutdown()

	IsListening() bool

	GetRegistry() IHandlersRegistry
}

Jump to

Keyboard shortcuts

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