Documentation
¶
Index ¶
- Variables
- func CachedAssetHeaders() map[string]string
- func GetBodyNormalizers() map[string]fieldProcessorFunc
- func GetBodySanitizers() map[string]fieldProcessorFunc
- func NewEchoApp(config ...EchoAppConfig) *echo.Echo
- func RegisterBodyNormalizer(name string, fn fieldProcessorFunc) error
- func RegisterBodySanitizer(name string, fn fieldProcessorFunc) error
- func SPAIndexHeaders() map[string]string
- func SecureStaticHeaders() map[string]string
- type ActionType
- type AuditLogConfig
- type AuthToken
- type Authorizer
- type CORSConfig
- type ContentType
- type Context
- type Count
- type EchoAppConfig
- type EchoContext
- func (ec *EchoContext) Bind(i any) error
- func (ec *EchoContext) Body() ([]byte, error)
- func (ec *EchoContext) JSON(code int, i any) error
- func (ec *EchoContext) Param(name string) string
- func (ec *EchoContext) Query(name string) string
- func (ec *EchoContext) Request() *http.Request
- func (ec *EchoContext) Response() http.ResponseWriter
- func (ec *EchoContext) String(code int, s string) error
- type EchoFileUploadHandler
- type Endpoint
- type EndpointContext
- func (eCtx *EndpointContext) Context() context.Context
- func (ctx *EndpointContext) Get(key string) any
- func (ctx *EndpointContext) GetAllUploadedFiles() map[string][]*UploadedFile
- func (eCtx *EndpointContext) GetFilterParam() (*database.FilterBuilder, error)
- func (ctx *EndpointContext) GetFirstUploadedFile(fieldName string) *UploadedFile
- func (ctx *EndpointContext) GetUploadedFiles(fieldName string) []*UploadedFile
- func (ctx *EndpointContext) HTML(response string, statusCode ...int) error
- func (ctx *EndpointContext) HasUploadedFiles(fieldName string) bool
- func (ctx *EndpointContext) JSON(response any, statusCode ...int) error
- func (ctx *EndpointContext) NoContent() error
- func (eCtx *EndpointContext) NormalizeStruct(v any) error
- func (ctx *EndpointContext) RespondAndLog(response any, affectedModelId any, contentType ResponseType, statusCode ...int) error
- func (eCtx *EndpointContext) SanitizeStruct(v any) error
- func (ctx *EndpointContext) SendCookie(cookie *http.Cookie) error
- func (ctx *EndpointContext) SendSecureCookie(cookie *http.Cookie) error
- func (ctx *EndpointContext) Set(key string, value any)
- func (ctx *EndpointContext) Text(response string, statusCode ...int) error
- func (eCtx *EndpointContext) ValidateStruct(v any) error
- func (ctx *EndpointContext) XML(response any, statusCode ...int) error
- type EndpointMethod
- type EndpointRole
- type Exists
- type FileExtension
- type FileFieldConfig
- type FileUploadConfig
- type HandlerFunc
- type HeaderMatchFunc
- type HeaderParamType
- type LogLevel
- type MiddlewareFunc
- type Normalizeable
- type Param
- type ParamErrors
- type ParamLocation
- type PathParamType
- type Principal
- type QueryParamType
- type RateLimit
- type ResponseType
- type RestApp
- func (receiver *RestApp) Authorize(ctx *EndpointContext) error
- func (receiver *RestApp) Debugf(format string, args ...any)
- func (receiver *RestApp) Destroy() error
- func (receiver *RestApp) Errorf(format string, args ...any)
- func (receiver *RestApp) GetEnvironment() string
- func (receiver *RestApp) Group(path string, m ...MiddlewareFunc) *RouterGroup
- func (receiver *RestApp) Infof(format string, args ...any)
- func (receiver *RestApp) RegisterEndpoint(ep *Endpoint, r *RouterGroup)
- func (receiver *RestApp) RegisterEndpoints(endpoints []*Endpoint, r *RouterGroup)
- func (receiver *RestApp) ServeStatic(config StaticConfig) error
- func (receiver *RestApp) Start() error
- func (receiver *RestApp) Test(req *http.Request, timeout ...int) (*http.Response, error)
- func (receiver *RestApp) Warnf(format string, args ...any)
- type RestAppOptions
- type RouterGroup
- type Sanitizeable
- type SecurityConfig
- type StaticConfig
- type UploadedFile
- type Validable
Constants ¶
This section is empty.
Variables ¶
var ( ImageExtensions = []FileExtension{ FileExtensionJPEG, FileExtensionJPG, FileExtensionPNG, FileExtensionGIF, FileExtensionWEBP, FileExtensionSVG, FileExtensionBMP, FileExtensionTIFF, } DocumentExtensions = []FileExtension{ FileExtensionPDF, FileExtensionDOC, FileExtensionDOCX, FileExtensionXLS, FileExtensionXLSX, FileExtensionPPT, FileExtensionPPTX, FileExtensionTXT, FileExtensionRTF, FileExtensionODT, FileExtensionODS, FileExtensionODP, } ArchiveExtensions = []FileExtension{ FileExtensionZIP, FileExtensionRAR, FileExtension7Z, FileExtensionTAR, FileExtensionGZ, } VideoExtensions = []FileExtension{ FileExtensionMP4, FileExtensionAVI, FileExtensionMOV, FileExtensionWMV, FileExtensionFLV, FileExtensionMKV, FileExtensionWEBM, } AudioExtensions = []FileExtension{ FileExtensionMP3, FileExtensionWAV, FileExtensionFLAC, FileExtensionAAC, FileExtensionOGG, FileExtensionWMA, } CodeExtensions = []FileExtension{ FileExtensionJS, FileExtensionTS, FileExtensionPY, FileExtensionGO, FileExtensionJAVA, FileExtensionC, FileExtensionCPP, FileExtensionCSS, FileExtensionHTML, FileExtensionXML, FileExtensionJSON, FileExtensionYAML, FileExtensionYML, } )
Predefined file type groups
var LogLevelLabels = map[LogLevel]string{ LogLevelDebug: "DEBUG", LogLevelInfo: "INFO", LogLevelWarn: "WARN", LogLevelError: "ERROR", }
Functions ¶
func CachedAssetHeaders ¶
CachedAssetHeaders returns headers for cacheable assets (with hash in filename)
func GetBodyNormalizers ¶
func GetBodyNormalizers() map[string]fieldProcessorFunc
GetBodyNormalizers devuelve una copia de los normalizadores registrados
func GetBodySanitizers ¶
func GetBodySanitizers() map[string]fieldProcessorFunc
GetBodySanitizers devuelve una copia de los sanitizadores registrados
func NewEchoApp ¶
func NewEchoApp(config ...EchoAppConfig) *echo.Echo
func RegisterBodyNormalizer ¶
RegisterBodyNormalizer permite registrar nuevos normalizadores personalizados
func RegisterBodySanitizer ¶
RegisterBodySanitizer permite registrar nuevos sanitizadores personalizados
func SPAIndexHeaders ¶
SPAIndexHeaders returns headers for index.html in SPA mode (no caching)
func SecureStaticHeaders ¶
SecureStaticHeaders returns secure default headers for static files
Types ¶
type ActionType ¶
type ActionType string
const ( ActionTypeRead ActionType = "read" ActionTypeCreate ActionType = "create" ActionTypeUpdate ActionType = "update" ActionTypeDelete ActionType = "delete" ActionTypeLogin ActionType = "login" ActionTypeLogout ActionType = "logout" ActionTypeResetPassword ActionType = "reset_password" ActionTypeChangePassword ActionType = "change_password" ActionTypeFileUpload ActionType = "file_upload" )
type AuditLogConfig ¶
type AuditLogConfig struct {
Enabled bool
Handler func(ctx *EndpointContext, response any, affectedModelId any) error
}
type Authorizer ¶
type Authorizer func(*EndpointContext) (Principal, AuthToken, error)
type CORSConfig ¶
type CORSConfig struct {
Enabled bool
AllowOrigins []string
AllowMethods []string
AllowHeaders []string
AllowCredentials bool
AllowOriginFunc func(origin string) (bool, error)
}
CORSConfig configuración para CORS middleware
type ContentType ¶
type ContentType string
ContentType defines the types of content an endpoint can accept
const ( ContentTypeJSON ContentType = "application/json" ContentTypeMultipart ContentType = "multipart/form-data" ContentTypeFormData ContentType = "application/x-www-form-urlencoded" ContentTypeAny ContentType = "*/*" // Accept any content type )
type Context ¶
type Context interface {
Request() *http.Request
Response() http.ResponseWriter
Param(name string) string
Query(name string) string
Body() ([]byte, error)
JSON(code int, i any) error
String(code int, s string) error
Bind(i any) error
}
Context represents a generic HTTP request/response context
type EchoAppConfig ¶
type EchoAppConfig struct {
CORS *CORSConfig
Security *SecurityConfig
}
EchoAppConfig contiene todas las configuraciones para el Echo app
func DefaultEchoAppConfig ¶
func DefaultEchoAppConfig() EchoAppConfig
DefaultEchoAppConfig retorna una configuración por defecto
type EchoContext ¶
EchoContext wraps echo.Context to implement our generic Context interface
func (*EchoContext) Bind ¶
func (ec *EchoContext) Bind(i any) error
func (*EchoContext) Body ¶
func (ec *EchoContext) Body() ([]byte, error)
func (*EchoContext) Param ¶
func (ec *EchoContext) Param(name string) string
func (*EchoContext) Query ¶
func (ec *EchoContext) Query(name string) string
func (*EchoContext) Request ¶
func (ec *EchoContext) Request() *http.Request
func (*EchoContext) Response ¶
func (ec *EchoContext) Response() http.ResponseWriter
type EchoFileUploadHandler ¶
type EchoFileUploadHandler struct {
// contains filtered or unexported fields
}
StreamingFileUploadHandler handles file uploads with Echo's multipart capabilities
func NewEchoFileUploadHandler ¶
func NewEchoFileUploadHandler(config *FileUploadConfig) *EchoFileUploadHandler
NewEchoFileUploadHandler creates a new Echo file upload handler
func (*EchoFileUploadHandler) CleanupAfterResponse ¶
func (h *EchoFileUploadHandler) CleanupAfterResponse(uploadedFiles map[string][]*UploadedFile)
CleanupAfterResponse removes temporary files after sending response
func (*EchoFileUploadHandler) ProcessStreamingFileUploads ¶
func (h *EchoFileUploadHandler) ProcessStreamingFileUploads(c echo.Context) (map[string][]*UploadedFile, map[string][]string, error)
ProcessStreamingFileUploads processes multipart form data using Echo's multipart parsing with size limits
type Endpoint ¶
type Endpoint struct {
Name string
Method EndpointMethod
Path string
Handler func(c *EndpointContext) error
Disabled bool // If true, the endpoint is disabled and will not be registered or accessible.
BodyParams func() any // Function that returns a struct for body binding.
Scope string
RateLimiter func(*EndpointContext) RateLimit // Function to get rate limit configuration for the endpoint.
Public bool // If true, the endpoint is publicly accessible without authentication.
Roles []EndpointRole // List of roles that can access this endpoint.
AllowedIncludes map[EndpointRole][]string
ActionType string // e.g., "create", "read", "update", "delete". Used for logging.
Model string // The related model or resource, e.g., "User", "Order", etc. Used for logging
Accepts []Param
AuditDisabled bool // Disable audit logging for this endpoint
Timeout uint16 // Maximum timeout for the endpoint in seconds
MetaData map[string]any // Additional metadata for the endpoint
// Content type configuration
AcceptedContentTypes []ContentType // Explicitly define what content types this endpoint accepts
// File upload configuration
FileUploadConfig *FileUploadConfig // Global file upload settings for this endpoint
// contains filtered or unexported fields
}
type EndpointContext ¶
type EndpointContext struct {
App *RestApp
EchoCtx echo.Context
Endpoint *Endpoint
ParsedBody any
ParsedQuery map[string]any
ParsedPath map[string]any
ParsedHeader map[string]any
UploadedFiles map[string][]*UploadedFile
FormValues map[string][]string // Non-file form values from multipart forms
IpAddress string
Principal Principal
Token AuthToken
// contains filtered or unexported fields
}
func (*EndpointContext) Context ¶
func (eCtx *EndpointContext) Context() context.Context
func (*EndpointContext) Get ¶
func (ctx *EndpointContext) Get(key string) any
Get retrieves a value from the context by key
func (*EndpointContext) GetAllUploadedFiles ¶
func (ctx *EndpointContext) GetAllUploadedFiles() map[string][]*UploadedFile
GetAllUploadedFiles returns all uploaded files across all fields
func (*EndpointContext) GetFilterParam ¶
func (eCtx *EndpointContext) GetFilterParam() (*database.FilterBuilder, error)
GetFilterParam retrieves the filter parameter from either the query or header.
func (*EndpointContext) GetFirstUploadedFile ¶
func (ctx *EndpointContext) GetFirstUploadedFile(fieldName string) *UploadedFile
GetFirstUploadedFile returns the first uploaded file for a specific field name
func (*EndpointContext) GetUploadedFiles ¶
func (ctx *EndpointContext) GetUploadedFiles(fieldName string) []*UploadedFile
GetUploadedFiles returns uploaded files for a specific field name
func (*EndpointContext) HTML ¶
func (ctx *EndpointContext) HTML(response string, statusCode ...int) error
HTML sends an HTML response
func (*EndpointContext) HasUploadedFiles ¶
func (ctx *EndpointContext) HasUploadedFiles(fieldName string) bool
HasUploadedFiles returns true if there are uploaded files for the specified field
func (*EndpointContext) JSON ¶
func (ctx *EndpointContext) JSON(response any, statusCode ...int) error
JSON sends a JSON response
func (*EndpointContext) NoContent ¶
func (ctx *EndpointContext) NoContent() error
NoContent sends a 204 No Content response
func (*EndpointContext) NormalizeStruct ¶
func (eCtx *EndpointContext) NormalizeStruct(v any) error
func (*EndpointContext) RespondAndLog ¶
func (ctx *EndpointContext) RespondAndLog(response any, affectedModelId any, contentType ResponseType, statusCode ...int) error
*
- RespondAndLog sends a response and logs the audit if enabled.
- @param response The response data to send.
- @param affectedModelId The ID of the model affected by the operation, used for logging.
- @param contentType The type of response to send (JSON, XML, Text, HTML, NoContent).
- @param statuCode Optional status code to override the default 200 OK.
- @return error if any issue occurs while sending the response or logging the audit.
func (*EndpointContext) SanitizeStruct ¶
func (eCtx *EndpointContext) SanitizeStruct(v any) error
func (*EndpointContext) SendCookie ¶
func (ctx *EndpointContext) SendCookie(cookie *http.Cookie) error
SendCookie sends a cookie in the response with a 204 No Content status
func (*EndpointContext) SendSecureCookie ¶
func (ctx *EndpointContext) SendSecureCookie(cookie *http.Cookie) error
func (*EndpointContext) Set ¶
func (ctx *EndpointContext) Set(key string, value any)
Set allows setting a value in the context
func (*EndpointContext) Text ¶
func (ctx *EndpointContext) Text(response string, statusCode ...int) error
Text sends a plain text response
func (*EndpointContext) ValidateStruct ¶
func (eCtx *EndpointContext) ValidateStruct(v any) error
type EndpointMethod ¶
type EndpointMethod string
const ( MethodHEAD EndpointMethod = "Head" MethodGET EndpointMethod = "Get" MethodPOST EndpointMethod = "Post" MethodPUT EndpointMethod = "Put" MethodPATCH EndpointMethod = "Patch" MethodDELETE EndpointMethod = "Delete" )
type EndpointRole ¶
type EndpointRole interface {
RoleName() string
}
type FileExtension ¶
type FileExtension string
FileUpload types and configurations
const ( // Image formats FileExtensionJPEG FileExtension = ".jpeg" FileExtensionJPG FileExtension = ".jpg" FileExtensionPNG FileExtension = ".png" FileExtensionGIF FileExtension = ".gif" FileExtensionWEBP FileExtension = ".webp" FileExtensionSVG FileExtension = ".svg" FileExtensionBMP FileExtension = ".bmp" FileExtensionTIFF FileExtension = ".tiff" // Document formats FileExtensionPDF FileExtension = ".pdf" FileExtensionDOC FileExtension = ".doc" FileExtensionDOCX FileExtension = ".docx" FileExtensionXLS FileExtension = ".xls" FileExtensionXLSX FileExtension = ".xlsx" FileExtensionPPT FileExtension = ".ppt" FileExtensionPPTX FileExtension = ".pptx" FileExtensionTXT FileExtension = ".txt" FileExtensionRTF FileExtension = ".rtf" FileExtensionODT FileExtension = ".odt" FileExtensionODS FileExtension = ".ods" FileExtensionODP FileExtension = ".odp" // Archive formats FileExtensionZIP FileExtension = ".zip" FileExtensionRAR FileExtension = ".rar" FileExtension7Z FileExtension = ".7z" FileExtensionTAR FileExtension = ".tar" FileExtensionGZ FileExtension = ".gz" // Video formats FileExtensionMP4 FileExtension = ".mp4" FileExtensionAVI FileExtension = ".avi" FileExtensionMOV FileExtension = ".mov" FileExtensionWMV FileExtension = ".wmv" FileExtensionFLV FileExtension = ".flv" FileExtensionMKV FileExtension = ".mkv" FileExtensionWEBM FileExtension = ".webm" // Audio formats FileExtensionMP3 FileExtension = ".mp3" FileExtensionWAV FileExtension = ".wav" FileExtensionFLAC FileExtension = ".flac" FileExtensionAAC FileExtension = ".aac" FileExtensionOGG FileExtension = ".ogg" FileExtensionWMA FileExtension = ".wma" // Code formats FileExtensionJS FileExtension = ".js" FileExtensionTS FileExtension = ".ts" FileExtensionPY FileExtension = ".py" FileExtensionGO FileExtension = ".go" FileExtensionJAVA FileExtension = ".java" FileExtensionC FileExtension = ".c" FileExtensionCPP FileExtension = ".cpp" FileExtensionCSS FileExtension = ".css" FileExtensionHTML FileExtension = ".html" FileExtensionXML FileExtension = ".xml" FileExtensionJSON FileExtension = ".json" FileExtensionYAML FileExtension = ".yaml" FileExtensionYML FileExtension = ".yml" // Other formats FileExtensionCSV FileExtension = ".csv" )
type FileFieldConfig ¶
type FileFieldConfig struct {
FieldName string // Form field name
Required bool // Whether the field is required
MaxFileSize int64 // Max file size for this field (0 = use global)
AllowedTypes []FileExtension // Allowed extensions for this field (nil = use global)
MaxFiles int // Maximum number of files for this field (0 = unlimited)
TypeSizeLimits map[FileExtension]int64 // Size limits per file type for this field
}
FileFieldConfig represents configuration for a specific file field
type FileUploadConfig ¶
type FileUploadConfig struct {
MaxFileSize int64 // Default max file size in bytes
FileFields map[string]*FileFieldConfig // Configuration for specific file fields
TypeSizeLimits map[FileExtension]int64 // Size limits per file type
UploadPath string // Base upload directory
TempPath string // Temporary files directory
KeepFilesAfterSend bool // Whether to keep files after response
}
FileUploadConfig represents the global file upload configuration
type HandlerFunc ¶
HandlerFunc represents a generic HTTP handler function
type HeaderMatchFunc ¶
HeaderMatchFunc is a function that returns headers based on the request path and file path
type HeaderParamType ¶
type HeaderParamType string
const ( HeaderParamTypeString HeaderParamType = "string" HeaderParamTypeInt HeaderParamType = "int" HeaderParamTypeFloat HeaderParamType = "float" HeaderParamTypeBool HeaderParamType = "bool" HeaderParamTypeDate HeaderParamType = "date" HeaderParamTypeDateTime HeaderParamType = "datetime" HeaderParamTypeObjectID HeaderParamType = "objectid" HeaderParamTypeFilter HeaderParamType = "filter" HeaderParamTypeWhere HeaderParamType = "where" )
type MiddlewareFunc ¶
type MiddlewareFunc func(HandlerFunc) HandlerFunc
MiddlewareFunc represents a generic middleware function
type Normalizeable ¶
type Normalizeable interface {
Normalize(ctx *EndpointContext) error
}
Normalizeable is an interface that defines a method for normalizing an endpoint context
type Param ¶
func NewHeaderParam ¶
func NewHeaderParam(name string, paramType HeaderParamType, required ...bool) Param
func NewPathParam ¶
func NewPathParam(name string, paramType PathParamType) Param
func NewQueryParam ¶
func NewQueryParam(name string, paramType QueryParamType, required ...bool) Param
type ParamErrors ¶
type ParamErrors []http_errors.ErrorResponse
func (ParamErrors) Error ¶
func (pe ParamErrors) Error() string
type ParamLocation ¶
type ParamLocation string
const ( InQuery ParamLocation = "query" InPath ParamLocation = "path" InHeader ParamLocation = "header" )
type PathParamType ¶
type PathParamType string
const ( PathParamTypeString PathParamType = "string" PathParamTypeInt PathParamType = "int" PathParamTypeFloat PathParamType = "float" PathParamTypeBool PathParamType = "bool" PathParamTypeDate PathParamType = "date" PathParamTypeDateTime PathParamType = "datetime" PathParamTypeObjectID PathParamType = "objectid" )
type QueryParamType ¶
type QueryParamType string
const ( QueryParamTypeString QueryParamType = "string" QueryParamTypeInt QueryParamType = "int" QueryParamTypeFloat QueryParamType = "float" QueryParamTypeBool QueryParamType = "bool" QueryParamTypeDate QueryParamType = "date" QueryParamTypeDateTime QueryParamType = "datetime" QueryParamTypeObjectID QueryParamType = "objectid" QueryParamTypeFilter QueryParamType = "filter" QueryParamTypeWhere QueryParamType = "where" )
type ResponseType ¶
type ResponseType string
const ( ResponseTypeJSON ResponseType = "json" ResponseTypeXML ResponseType = "xml" ResponseTypeText ResponseType = "text" ResponseTypeHTML ResponseType = "html" ResponseTypeNoContent ResponseType = "no_content" ResponseTypeFile ResponseType = "file" ResponseTypeCookie ResponseType = "cookie" ResponseTypeSecureCookie ResponseType = "secure_cookie" )
type RestApp ¶
type RestApp struct {
EchoApp *echo.Echo
Datasource *database.Datasource
ValidatorInstance *validator.Validate
// contains filtered or unexported fields
}
func NewRestApp ¶
func NewRestApp(appOptions RestAppOptions) *RestApp
func (*RestApp) Authorize ¶
func (receiver *RestApp) Authorize(ctx *EndpointContext) error
func (*RestApp) GetEnvironment ¶
func (*RestApp) Group ¶
func (receiver *RestApp) Group(path string, m ...MiddlewareFunc) *RouterGroup
func (*RestApp) RegisterEndpoint ¶
func (receiver *RestApp) RegisterEndpoint(ep *Endpoint, r *RouterGroup)
func (*RestApp) RegisterEndpoints ¶
func (receiver *RestApp) RegisterEndpoints(endpoints []*Endpoint, r *RouterGroup)
func (*RestApp) ServeStatic ¶
func (receiver *RestApp) ServeStatic(config StaticConfig) error
ServeStatic configures the application to serve static files
type RestAppOptions ¶
type RestAppOptions struct {
Name string
Port uint16
Datasource *database.Datasource
LogLevel LogLevel
EnableRateLimiter bool
Authorizer Authorizer
AuditLogConfig *AuditLogConfig
CORS *CORSConfig // Configuración de CORS
Security *SecurityConfig // Configuración de Security middleware
}
type RouterGroup ¶
type RouterGroup struct {
// contains filtered or unexported fields
}
RouterGroup wraps framework-specific router groups to provide a generic interface
func (*RouterGroup) Group ¶
func (rg *RouterGroup) Group(path string, m ...MiddlewareFunc) *RouterGroup
Group creates a subgroup with the specified path and middleware
func (*RouterGroup) Use ¶
func (rg *RouterGroup) Use(m ...MiddlewareFunc)
Use adds middleware to the router group
type Sanitizeable ¶
type Sanitizeable interface {
Sanitize(ctx *EndpointContext) error
}
Sanitizeable is an interface that defines a method for sanitizing an endpoint context
type SecurityConfig ¶
type SecurityConfig struct {
Enabled bool
}
SecurityConfig configuración para Security middleware
type StaticConfig ¶
type StaticConfig struct {
Prefix string // URL prefix (e.g., "/", "/assets")
Directory string // Physical directory to serve
EnableSPA bool // Enable SPA mode (fallback to index.html)
IndexFile string // Index file name (default: "index.html")
EnableBrowse bool // Allow directory browsing
ExcludePrefixes []string // Path prefixes to exclude from SPA fallback (e.g., "/api", "/swagger")
Headers map[string]string // Base headers for all files
IndexHeaders map[string]string // Headers specific to index file
AssetHeaders map[string]string // Headers for assets (.js, .css, images, etc.)
HeaderMatcher HeaderMatchFunc // Custom function for header matching (takes priority)
}
StaticConfig holds the configuration for serving static files
type UploadedFile ¶
type UploadedFile struct {
FieldName string `json:"field_name"`
OriginalName string `json:"original_name"`
Filename string `json:"filename"`
Size int64 `json:"size"`
Extension string `json:"extension"`
MimeType string `json:"mime_type"`
Path string `json:"path"`
TempPath string `json:"temp_path"`
}
UploadedFile represents an uploaded file
type Validable ¶
type Validable interface {
Validate(ctx *EndpointContext) error
}
Validable is an interface that defines a method for validating an endpoint context