Documentation
¶
Index ¶
- Constants
- Variables
- func ClearCookie(w http.ResponseWriter) error
- func CookieRead(r *http.Request, name string) (string, error)
- func CookieReadEncrypted(r *http.Request, name string, secretKey []byte) (string, error)
- func CookieWrite(w http.ResponseWriter, cookie http.Cookie) error
- func CookieWriteEncrypted(w http.ResponseWriter, cookie http.Cookie, secretKey []byte) error
- func CreateAuthTokenHashedCacheKey(userID uint, userAgent string) string
- func DisableEvents()
- func EnableEvents()
- func Graph(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func NewGorm() *gorm.DB
- func NewTemplates(components embed.FS, templates embed.FS)
- func RenderNamedTemplate(name string, data interface{}) (template.HTML, error)
- func ResolveGorm() *gorm.DB
- func ResolveSchedulerStore() *scheduler.Store
- func SchedulerSemaphoreIsGreen() bool
- func SchedulerSemaphoreSetGreen()
- func SchedulerSemaphoreSetRed()
- func SetCookie(w http.ResponseWriter, email string, token string) error
- func SetCookieWithMaxAge(w http.ResponseWriter, email string, token string, maxAge int) error
- func UseHook(mw Hook)
- type App
- func (app *App) Bootstrap()
- func (app *App) MakeDirs(dirs ...string)
- func (app *App) Next(c *Context)
- func (app *App) RegisterRoutes(routes []Route, router *httprouter.Router) *httprouter.Router
- func (app *App) RegisterTemplates(templates_resources embed.FS)
- func (app *App) Run(router *httprouter.Router)
- func (app *App) SetBasePath(path string)
- func (app *App) SetCacheConfig(c CacheConfig)
- func (app *App) SetGormConfig(g GormConfig)
- func (app *App) SetLogsDriver(d logger.LogsDriver)
- func (app *App) SetRequestConfig(r RequestConfig)
- func (app *App) SetRunMode(runmode string)
- type Asynqtask
- type Cache
- type CacheConfig
- type Context
- func (c *Context) CastToFloat(value interface{}) float64
- func (c *Context) CastToInt(value interface{}) int
- func (c *Context) CastToString(value interface{}) string
- func (c *Context) CopyFile(sourceFilePath string, destFolderPath string) error
- func (c *Context) DebugAny(variable interface{})
- func (c *Context) GetBaseDirPath() string
- func (c *Context) GetCookie() (UserCookie, error)
- func (c *Context) GetHeader(key string) string
- func (c *Context) GetPathParam(key string) interface{}
- func (c *Context) GetQueueClient() *asynq.Client
- func (c *Context) GetRequesBodyMap() map[string]interface{}
- func (c *Context) GetRequesBodyStruct(dest interface{}) error
- func (c *Context) GetRequesForm(key string) interface{}
- func (c *Context) GetRequestParam(key string) interface{}
- func (c *Context) GetUploadedFile(name string) (*UploadedFileInfo, error)
- func (c Context) GetUserAgent() string
- func (c *Context) MapToJson(v any) string
- func (c *Context) MoveFile(sourceFilePath string, destFolderPath string) error
- func (c *Context) Next()
- func (c *Context) RequestParamExists(key string) bool
- type Controller
- type EmailAddress
- type EmailAttachment
- type EnvFileConfig
- type Event
- type EventJob
- type EventsManager
- type GormConfig
- type Hashing
- type Hook
- type Hooks
- type JWT
- func (j *JWT) DecodeToken(token string) (payload map[string]interface{}, err error)
- func (j *JWT) DecodeTokenIgnoreExpiry(token string) (payload map[string]interface{}, err error)
- func (j *JWT) ExpiresAtIgnoreExpiry(token string) (time.Time, error)
- func (j *JWT) GenerateToken(payload map[string]interface{}) (string, error)
- func (j *JWT) HasExpired(token string) (bool, error)
- func (j *JWT) LifetimeMinutes() int
- type JWTConfig
- type JWTOptions
- type Mailer
- func (m *Mailer) Send() error
- func (m *Mailer) SetAttachments(attachments []EmailAttachment) *Mailer
- func (m *Mailer) SetBCC(emailAddresses []EmailAddress) *Mailer
- func (m *Mailer) SetCC(emailAddresses []EmailAddress) *Mailer
- func (m *Mailer) SetFrom(emailAddresses EmailAddress) *Mailer
- func (m *Mailer) SetHTMLBody(body string) *Mailer
- func (m *Mailer) SetPlainTextBody(body string) *Mailer
- func (m *Mailer) SetSubject(subject string) *Mailer
- func (m *Mailer) SetTo(emailAddresses []EmailAddress) *Mailer
- type QueueConfig
- type Queuemux
- type Request
- type RequestConfig
- type Response
- func (rs *Response) Any(body any) *Response
- func (rs *Response) BufferFile(name string, filetype string, b bytes.Buffer) *Response
- func (rs *Response) BufferInline(name string, filetype string, b bytes.Buffer) *Response
- func (rs *Response) ForceSendResponse()
- func (rs *Response) HTML(body string) *Response
- func (rs *Response) Json(body string) *Response
- func (rs *Response) Redirect(url string, use303 ...bool) *Response
- func (rs *Response) SetContentType(c string) *Response
- func (rs *Response) SetHeader(key string, val string) *Response
- func (rs *Response) SetStatusCode(code int) *Response
- func (rs *Response) Template(name string, data interface{}) *Response
- func (rs *Response) Text(body string) *Response
- type Route
- type Router
- func (r *Router) Delete(path string, controller Controller, hooks ...Hook) *Router
- func (r *Router) Get(path string, controller Controller, hooks ...Hook) *Router
- func (r *Router) GetRoutes() []Route
- func (r *Router) Head(path string, controller Controller, hooks ...Hook) *Router
- func (r *Router) Options(path string, controller Controller, hooks ...Hook) *Router
- func (r *Router) Patch(path string, controller Controller, hooks ...Hook) *Router
- func (r *Router) Post(path string, controller Controller, hooks ...Hook) *Router
- func (r *Router) Put(path string, controller Controller, hooks ...Hook) *Router
- type SchedulerConfig
- type Schedulermux
- func (s *Schedulermux) AddWork(taskType string, handler scheduler.HandlerFunc)
- func (s *Schedulermux) GetStore() *scheduler.Store
- func (s *Schedulermux) RunScheduler(config SchedulerConfig)
- func (s *Schedulermux) SchedulerInit()
- func (s *Schedulermux) SemaphoreSetGreen()
- func (s *Schedulermux) SemaphoreSetRed()
- func (s *Schedulermux) SetStore(st *scheduler.Store)
- func (s *Schedulermux) StopScheduler()
- type SessionUser
- func (s *SessionUser) Delete(key string) interface{}
- func (s *SessionUser) Flush() error
- func (s *SessionUser) Get(key string) (interface{}, bool)
- func (s *SessionUser) GetUserID() uint
- func (s *SessionUser) Init(c *Context) bool
- func (s *SessionUser) IsAuthenticated() bool
- func (s *SessionUser) Save() error
- func (s *SessionUser) Set(key string, value interface{}) error
- type UploadedFileInfo
- type UserCookie
- type Validator
Constants ¶
const CONTENT_TYPE string = "content-Type"
const CONTENT_TYPE_HTML string = "text/html; charset=utf-8"
const CONTENT_TYPE_IMAGEJPG string = "image/jpeg"
const CONTENT_TYPE_IMAGEPNG string = "image/png"
const CONTENT_TYPE_IMAGESVGXML string = "image/svg+xml"
const CONTENT_TYPE_JSON string = "application/json"
const CONTENT_TYPE_MULTIPART_FORM_DATA string = "multipart/form-data;"
const CONTENT_TYPE_TEXT string = "text/plain"
const DELETE string = "delete"
const GET string = "get"
const HEAD string = "head"
const LOCALHOST string = "http://localhost"
const OPTIONS string = "options"
const PATCH string = "patch"
const POST string = "post"
const PRODUCTION string = "production"
const PUT string = "put"
const TEST_STR string = "Testing!"
Variables ¶
var ( ErrValueTooLong = errors.New("cookie value too long") ErrInvalidValue = errors.New("invalid cookie value") )
ErrValueTooLong indicates that the cookie value exceeds the allowed length limit. ErrInvalidValue signifies that the cookie value is in an invalid format.
var DefaultSchedulerInterval = 10 * time.Second
Default values for SchedulerConfig
var DefaultSchedulerRateLimit = 10
Functions ¶
func ClearCookie ¶
func ClearCookie(w http.ResponseWriter) error
ClearCookie instructs the browser to delete the "goffee" session cookie. It writes an empty cookie with a MaxAge of -1 (immediate deletion) and an expiration in the past, using the same attributes as when the cookie was set (Path, HttpOnly, SameSite and Secure) so the browser reliably removes it.
This complements a server-side signout: deleting the cached token prevents any further authenticated use of the session, while clearing the cookie removes the now-useless cookie from the client.
func CookieRead ¶
CookieRead retrieves a base64-encoded cookie value by name from the HTTP request and decodes it. Returns the decoded value as a string or an error if the cookie is not found or the value is invalid.
func CookieReadEncrypted ¶
CookieReadEncrypted reads an encrypted cookie, decrypts its value using AES-GCM, and validates its name before returning. Returns the plaintext cookie value or an error if decryption or validation fails.
func CookieWrite ¶
func CookieWrite(w http.ResponseWriter, cookie http.Cookie) error
CookieWrite writes a secure HTTP cookie to the response writer after base64 encoding its value. Returns ErrValueTooLong if the cookie string exceeds the 4096-byte size limit.
func CookieWriteEncrypted ¶
CookieWriteEncrypted encrypts the cookie's value using AES-GCM and writes it to the HTTP response writer. The cookie name is authenticated along with its value. It returns an error if encryption fails or the cookie exceeds the maximum allowed length.
func CreateAuthTokenHashedCacheKey ¶
CreateAuthTokenHashedCacheKey generates a hashed cache key used to store JWT tokens and session data. The key is based on the user ID and user agent, hashed with MD5.
func DisableEvents ¶
func DisableEvents()
DisableEvents sets the global variable `disableEvents` to true, disabling the handling or triggering of events.
func EnableEvents ¶
func EnableEvents()
EnableEvents sets the global variable `disableEvents` to false, effectively enabling event handling.
func Graph ¶
func Graph(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
func NewGorm ¶
NewGorm initializes and returns a new gorm.DB instance based on the selected database driver specified in environment variables. Supported drivers include MySQL, PostgreSQL, and SQLite. Panics if the database driver is not specified or if a connection error occurs.
func RenderNamedTemplate ¶
RenderNamedTemplate executes a named template from the registered set with the given data and returns the rendered HTML. Usage:
html, err := core.RenderNamedTemplate("tabler_table", data)
if err != nil {
// handle error
}
return c.Response.HTML(string(html))
func ResolveGorm ¶
ResolveGorm initializes and returns a singleton instance of *gorm.DB, creating it if it doesn't already exist.
func ResolveSchedulerStore ¶
ResolveSchedulerStore returns the store from the global scheduler mux instance. Returns nil if the scheduler was never initialized.
func SchedulerSemaphoreIsGreen ¶
func SchedulerSemaphoreIsGreen() bool
SchedulerSemaphoreIsGreen returns whether the scheduler semaphore is currently green.
func SchedulerSemaphoreSetGreen ¶
func SchedulerSemaphoreSetGreen()
SchedulerSemaphoreSetGreen enables task execution by setting the semaphore to green.
func SchedulerSemaphoreSetRed ¶
func SchedulerSemaphoreSetRed()
SchedulerSemaphoreSetRed blocks task execution by setting the semaphore to red.
func SetCookie ¶
func SetCookie(w http.ResponseWriter, email string, token string) error
SetCookie sets an encrypted cookie with a user's email and token, using gob encoding for data serialization. The Secure flag is controlled by the COOKIE_SECURE environment variable (defaults to true, set to false for local HTTP development). The cookie lifetime is derived from JWT_LIFESPAN_MINUTES.
func SetCookieWithMaxAge ¶
SetCookieWithMaxAge sets the encrypted "goffee" cookie with an explicit lifetime in seconds. It is used for sliding session renewal, where the cookie expiration must be refreshed to a full lifetime from the moment of renewal.
Types ¶
type App ¶
type App struct {
Config *configContainer
// contains filtered or unexported fields
}
App is a struct representing the main application container and its core components.
func New ¶
func New() *App
New initializes and returns a new instance of the App structure with default configurations and chain.
func ResolveApp ¶
func ResolveApp() *App
ResolveApp returns the global instance of the App, providing access to its methods and configuration components.
func (*App) Bootstrap ¶
func (app *App) Bootstrap()
Bootstrap initializes the application by setting up the logger, router, and events manager.
func (*App) MakeDirs ¶
MakeDirs creates the specified directories under the base path with the provided permissions (0766).
func (*App) Next ¶
Next advances to the next middleware or controller in the chain and invokes it with the given context if available.
func (*App) RegisterRoutes ¶
func (app *App) RegisterRoutes(routes []Route, router *httprouter.Router) *httprouter.Router
RegisterRoutes sets up and registers HTTP routes and their handlers to the provided router, enabling request processing. It assigns appropriate methods, controllers, and hooks, while handling core services, errors, and fallback behaviors. Returns the configured router instance.
func (*App) RegisterTemplates ¶
RegisterTemplates initializes the application template system by embedding provided templates for rendering views.
func (*App) Run ¶
func (app *App) Run(router *httprouter.Router)
Run initializes the application's router, configures HTTPS if enabled, and starts the HTTP/HTTPS server.
func (*App) SetBasePath ¶
SetBasePath sets the base path for the application, which is used as a prefix for file and directory operations.
func (*App) SetCacheConfig ¶
func (app *App) SetCacheConfig(c CacheConfig)
SetCacheConfig sets the cache configuration for the application using the provided CacheConfig parameter.
func (*App) SetGormConfig ¶
func (app *App) SetGormConfig(g GormConfig)
SetGormConfig sets the GormConfig for the application, overriding the current configuration with the provided value.
func (*App) SetLogsDriver ¶
func (app *App) SetLogsDriver(d logger.LogsDriver)
SetLogsDriver sets the logging driver to be used by the application.
func (*App) SetRequestConfig ¶
func (app *App) SetRequestConfig(r RequestConfig)
SetRequestConfig sets the configuration for the request in the application instance.
func (*App) SetRunMode ¶
SetRunMode sets the application run mode to the specified value.
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func NewCache ¶
func NewCache(cacheConfig CacheConfig) *Cache
NewCache initializes a new Cache instance with the provided configuration and connects to a Redis database. If caching is enabled in the provided configuration but the connection to Redis fails, it causes a panic. Returns a pointer to the initialized Cache structure.
func (*Cache) Delete ¶
Delete removes the specified key from the cache and returns an error if the operation fails.
func (*Cache) Get ¶
Get retrieves the value associated with the provided key from the cache. Returns an error if the operation fails.
type CacheConfig ¶
type CacheConfig struct {
EnableCache bool
}
type Context ¶
type Context struct {
Request *Request
Response *Response
GetValidator func() *Validator
GetJWT func() *JWT
GetGorm func() *gorm.DB
GetCache func() *Cache
GetHashing func() *Hashing
GetMailer func() *Mailer
GetEventsManager func() *EventsManager
GetLogger func() *logger.Logger
GetSession func() *SessionUser
}
func (*Context) CastToFloat ¶
func (*Context) CastToString ¶
func (*Context) GetBaseDirPath ¶
func (*Context) GetCookie ¶
func (c *Context) GetCookie() (UserCookie, error)
func (*Context) GetPathParam ¶
func (*Context) GetQueueClient ¶
func (*Context) GetRequesBodyMap ¶
func (*Context) GetRequesBodyStruct ¶
get json body and bind to dest interface
func (*Context) GetRequesForm ¶
func (*Context) GetRequestParam ¶
func (*Context) GetUploadedFile ¶
func (c *Context) GetUploadedFile(name string) (*UploadedFileInfo, error)
func (Context) GetUserAgent ¶
func (*Context) RequestParamExists ¶
type Controller ¶
type EmailAddress ¶
type EmailAttachment ¶
type EnvFileConfig ¶
type EnvFileConfig struct {
UseDotEnvFile bool
}
type EventsManager ¶
type EventsManager struct {
// contains filtered or unexported fields
}
func NewEventsManager ¶
func NewEventsManager() *EventsManager
func ResolveEventsManager ¶
func ResolveEventsManager() *EventsManager
func (*EventsManager) Fire ¶
func (m *EventsManager) Fire(e *Event) error
func (*EventsManager) Register ¶
func (m *EventsManager) Register(eName string, job EventJob)
type GormConfig ¶
type GormConfig struct {
EnableGorm bool
}
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
func ResolveHooks ¶
func ResolveHooks() *Hooks
type JWT ¶
type JWT struct {
// contains filtered or unexported fields
}
func (*JWT) DecodeToken ¶
func (*JWT) DecodeTokenIgnoreExpiry ¶
DecodeTokenIgnoreExpiry decodes a token's payload without validating its expiration. It is used to inspect tokens that may already be expired (e.g. sliding session renewal), while still verifying the signature and the token structure.
func (*JWT) ExpiresAtIgnoreExpiry ¶
ExpiresAtIgnoreExpiry returns the expiration time carried by the token, without validating it. It verifies the signature and returns the token's "exp" claim.
func (*JWT) GenerateToken ¶
func (*JWT) LifetimeMinutes ¶
LifetimeMinutes returns the configured token lifetime in minutes.
type JWTOptions ¶
type Mailer ¶
type Mailer struct {
// contains filtered or unexported fields
}
func (*Mailer) SetAttachments ¶
func (m *Mailer) SetAttachments(attachments []EmailAttachment) *Mailer
func (*Mailer) SetBCC ¶
func (m *Mailer) SetBCC(emailAddresses []EmailAddress) *Mailer
func (*Mailer) SetCC ¶
func (m *Mailer) SetCC(emailAddresses []EmailAddress) *Mailer
func (*Mailer) SetFrom ¶
func (m *Mailer) SetFrom(emailAddresses EmailAddress) *Mailer
func (*Mailer) SetHTMLBody ¶
func (*Mailer) SetPlainTextBody ¶
func (*Mailer) SetSubject ¶
func (*Mailer) SetTo ¶
func (m *Mailer) SetTo(emailAddresses []EmailAddress) *Mailer
type QueueConfig ¶
type Queuemux ¶
type Queuemux struct {
// contains filtered or unexported fields
}
func (*Queuemux) RunQueueserver ¶
func (q *Queuemux) RunQueueserver(config QueueConfig)
RunQueueserver starts the queue server with the given configuration and handles tasks using the assigned ServeMux. Configures the queue server with concurrency limits and priority-based queue management. Logs and terminates the program if the server fails to run.
type RequestConfig ¶
type RequestConfig struct {
MaxUploadFileSize int
}
type Response ¶
type Response struct {
HttpResponseWriter http.ResponseWriter
// contains filtered or unexported fields
}
Response represents an HTTP response to be sent to the client, including headers, body, status code, and metadata.
func (*Response) Any ¶
sets the response's content type to HTML and assigns the provided body as the response body if not terminated.
func (*Response) BufferFile ¶
writes the contents of a buffer to the HTTP response with specified file name and type if not terminated.
func (*Response) BufferInline ¶
writes the contents of a buffer to the HTTP response with specified file name and type if not terminated.
func (*Response) ForceSendResponse ¶
func (rs *Response) ForceSendResponse()
terminates the response processing, preventing any further modifications or actions.
func (*Response) HTML ¶
sets the response's content type to HTML and assigns the provided string as the body if the response is not terminated.
func (*Response) Json ¶
sets the response's content type to JSON and assigns the provided string as the body if the response is not terminated.
func (*Response) Redirect ¶
Redirect sends a redirect response to the given URL. By default it uses 307 (Temporary Redirect) to preserve the HTTP method. Pass true as the second argument to use 303 (See Other), which changes POST to GET.
func (*Response) SetContentType ¶
sets a custom content type for the response if it is not terminated. Returns the updated Response object.
func (*Response) SetHeader ¶
adds or updates a header to the response if it is not terminated. Returns the updated Response object.
func (*Response) SetStatusCode ¶
sets the response status code if the response is not yet terminated. Returns the updated Response object.
type Route ¶
type Route struct {
Method string
Path string
Controller Controller
Hooks []Hook
}
Route defines an HTTP route with a method, path, controller function, and optional hooks for customization.
type Router ¶
type Router struct {
Routes []Route
}
Router represents a structure for storing and managing routes in the application.
func NewRouter ¶
func NewRouter() *Router
NewRouter initializes and returns a new Router instance with an empty slice of routes.
func ResolveRouter ¶
func ResolveRouter() *Router
ResolveRouter returns the singleton instance of the Router. It initializes and manages HTTP routes configuration.
func (*Router) Delete ¶
func (r *Router) Delete(path string, controller Controller, hooks ...Hook) *Router
Delete registers a DELETE HTTP method route with the specified path, controller, and optional hooks.
func (*Router) Get ¶
func (r *Router) Get(path string, controller Controller, hooks ...Hook) *Router
Get registers a GET route with the specified path, controller, and optional hooks, returning the updated Router.
func (*Router) GetRoutes ¶
GetRoutes returns a slice of Route objects currently registered within the Router.
func (*Router) Head ¶
func (r *Router) Head(path string, controller Controller, hooks ...Hook) *Router
Head registers a route with the HTTP HEAD method, associates it with a path, controller, and optional hooks.
func (*Router) Options ¶
func (r *Router) Options(path string, controller Controller, hooks ...Hook) *Router
Options registers a new route with the OPTIONS HTTP method, a specified path, controller, and optional hooks.
func (*Router) Patch ¶
func (r *Router) Patch(path string, controller Controller, hooks ...Hook) *Router
Patch registers a new route with the HTTP PATCH method, a specified path, a controller, and optional hooks.
type SchedulerConfig ¶
type Schedulermux ¶
type Schedulermux struct {
// contains filtered or unexported fields
}
Schedulermux wraps the scheduler Registry and manages the lifecycle of a simple database-backed task scheduler.
func (*Schedulermux) AddWork ¶
func (s *Schedulermux) AddWork(taskType string, handler scheduler.HandlerFunc)
AddWork registers a task handler function for a given task type.
func (*Schedulermux) GetStore ¶
func (s *Schedulermux) GetStore() *scheduler.Store
GetStore returns the scheduler store, or nil if not initialized.
func (*Schedulermux) RunScheduler ¶
func (s *Schedulermux) RunScheduler(config SchedulerConfig)
RunScheduler starts the scheduler loop with the given configuration. It auto-migrates the scheduler_meta table, recovers the persisted semaphore state, creates the in-memory semaphore, and launches the scheduler goroutine.
func (*Schedulermux) SchedulerInit ¶
func (s *Schedulermux) SchedulerInit()
SchedulerInit initializes the scheduler internals (registry). The store must be set separately via SetStore before starting. The semaphore is created lazily during RunScheduler once the DB is available.
func (*Schedulermux) SemaphoreSetGreen ¶
func (s *Schedulermux) SemaphoreSetGreen()
SemaphoreSetGreen allows task execution to proceed.
func (*Schedulermux) SemaphoreSetRed ¶
func (s *Schedulermux) SemaphoreSetRed()
SemaphoreSetRed blocks task execution.
func (*Schedulermux) SetStore ¶
func (s *Schedulermux) SetStore(st *scheduler.Store)
SetStore sets the store (backed by *gorm.DB) on the scheduler. This also runs AutoMigrate for the queue_items and processed_items tables.
func (*Schedulermux) StopScheduler ¶
func (s *Schedulermux) StopScheduler()
StopScheduler gracefully stops the scheduler loop.
type SessionUser ¶
type SessionUser struct {
// contains filtered or unexported fields
}
SessionUser handles user session data management with thread-safe operations. Sessions are stored in the cache (Redis) and are tied to an authenticated user via JWT tokens stored in cookies.
func (*SessionUser) Delete ¶
func (s *SessionUser) Delete(key string) interface{}
Delete removes a specific key from the session and persists the change. Returns the deleted value if it existed.
func (*SessionUser) Flush ¶
func (s *SessionUser) Flush() error
Flush deletes all session data from the cache.
func (*SessionUser) Get ¶
func (s *SessionUser) Get(key string) (interface{}, bool)
Get retrieves a value from the session. Returns the value and a boolean indicating if the key exists.
func (*SessionUser) GetUserID ¶
func (s *SessionUser) GetUserID() uint
GetUserID returns the user ID of the authenticated session user.
func (*SessionUser) Init ¶
func (s *SessionUser) Init(c *Context) bool
Init initializes the session by validating the user's JWT token from the cookie. It checks the cached token, verifies it matches, and loads any existing session data. Returns true if the session was successfully established.
func (*SessionUser) IsAuthenticated ¶
func (s *SessionUser) IsAuthenticated() bool
IsAuthenticated returns whether the session has been successfully authenticated.
func (*SessionUser) Save ¶
func (s *SessionUser) Save() error
Save persists the current session values to the cache.
func (*SessionUser) Set ¶
func (s *SessionUser) Set(key string, value interface{}) error
Set stores a value in the session and persists it to the cache.
type UploadedFileInfo ¶
type UserCookie ¶
UserCookie represents a structure to hold user-specific data stored in a cookie, including Email and Token fields.