Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init(model SessionModel)
Init sets the package-level SessionModel used by @call Func wrappers.
Types ¶
type DeleteRequest ¶
type DeleteRequest struct {
Key string
}
type DeleteResponse ¶
type DeleteResponse struct{}
func Delete ¶
func Delete(req DeleteRequest) (DeleteResponse, error)
type GetRequest ¶
type GetRequest struct {
Key string
}
type GetResponse ¶
type GetResponse struct {
Value string
}
func Get ¶
func Get(req GetRequest) (GetResponse, error)
type SessionModel ¶
type SessionModel interface {
Set(ctx context.Context, key string, value any, ttl time.Duration) error
Get(ctx context.Context, key string) (string, error)
Delete(ctx context.Context, key string) error
}
SessionModel provides key-value + TTL storage for user-bound state (login, cart, etc.).
func NewMemorySession ¶
func NewMemorySession() SessionModel
NewMemorySession creates an in-memory SessionModel. Data is lost on restart.
func NewPostgresSession ¶
NewPostgresSession creates a SessionModel backed by PostgreSQL. It auto-creates the fullend_sessions table if not exists.
type SetRequest ¶
type SetResponse ¶
type SetResponse struct{}
func Set ¶
func Set(req SetRequest) (SetResponse, error)
Source Files
¶
- default_model.go
- delete.go
- delete_request.go
- delete_response.go
- get.go
- get_request.go
- get_response.go
- memory_entry.go
- memory_session.go
- memory_session_delete.go
- memory_session_get.go
- memory_session_set.go
- new_memory_session.go
- new_postgres_session.go
- postgres_session.go
- postgres_session_delete.go
- postgres_session_get.go
- postgres_session_set.go
- session_model.go
- set.go
- set_request.go
- set_response.go
Click to show internal directories.
Click to hide internal directories.