session

package
v2.0.0-rc13 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package session holds code to manage state in a cookie. TODO: continue this? If the only use case is to start the

server locally and run one session, then there's no case
for storing a cookie and quickly putting the user back
to the same codeblock in the same markdown.  OTOH, if there's
a development cycle here where the markdown is being editted
and reloaded, using a cookie to get back to the same spot
in the same markdown file could be nice.

Index

Constants

This section is empty.

Variables

View Source
var (
	//go:embed session.js
	Js string
)

Functions

func AssureDefaults

func AssureDefaults(s *sessions.Session)

AssureDefaults inserts default values if values are missing.

Types

type Bucket

type Bucket struct {
	// The session ID.
	MdSessID TypeSessID
	// Is the header showing?
	IsHeaderOn bool
	// Is the nav showing?
	IsNavOn bool
	// The active markdown file.
	MdFileIndex int
	// The active block in that file.
	BlockIndex int
}

Bucket holds session state data, presumably associated with a cookie.

func ConvertToBucket

func ConvertToBucket(s *sessions.Session) *Bucket

ConvertToBucket creates a SessionData instance; a copy of the session data but in typesafe fields rather than a map of string to any.

type TypeSessID

type TypeSessID string

TypeSessID represents a session ID.

Jump to

Keyboard shortcuts

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