common

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger = initLogger()
View Source
var SessionName = "_jsessionid"
View Source
var SessionStore = sessions.NewCookieStore([]byte(os.Getenv("SESSION_KEY")))

Functions

This section is empty.

Types

type FlashMessage

type FlashMessage struct {
	Msg  string
	Type string
}

type LoggerWithTrace

type LoggerWithTrace struct {
	*slog.Logger
}

LoggerWithTrace is a wrapper around slog.Logger that adds a Trace method.

func (*LoggerWithTrace) Trace

func (l *LoggerWithTrace) Trace(msg string, keyvals ...interface{})

Trace logs a message at the trace level.

func (*LoggerWithTrace) WithTrace

func (l *LoggerWithTrace) WithTrace() *LoggerWithTrace

WithTrace returns the LoggerWithTrace instance.

type Session

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

func GetSession

func GetSession(r *http.Request) (*Session, error)

func (*Session) AddFlash

func (s *Session) AddFlash(flashType string, msg string)

func (*Session) ConsumeFlashes

func (s *Session) ConsumeFlashes() []FlashMessage

func (*Session) Get

func (s *Session) Get(key string) any

func (*Session) GetString

func (s *Session) GetString(key string) string

func (*Session) NeedsSave

func (s *Session) NeedsSave() bool

func (*Session) Reset

func (s *Session) Reset(r *http.Request, w http.ResponseWriter) error

func (*Session) Save

func (s *Session) Save(r *http.Request, w http.ResponseWriter) error

func (*Session) Set

func (s *Session) Set(key string, value any)

Jump to

Keyboard shortcuts

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