kuvia2/vendor/github.com/flamego/session
2022-01-15 00:09:03 +01:00
..
redis Init 2022-01-15 00:09:03 +01:00
.gitignore Init 2022-01-15 00:09:03 +01:00
.golangci.yml Init 2022-01-15 00:09:03 +01:00
codecov.yml Init 2022-01-15 00:09:03 +01:00
file.go Init 2022-01-15 00:09:03 +01:00
LICENSE Init 2022-01-15 00:09:03 +01:00
manager.go Init 2022-01-15 00:09:03 +01:00
memory.go Init 2022-01-15 00:09:03 +01:00
README.md Init 2022-01-15 00:09:03 +01:00
session.go Init 2022-01-15 00:09:03 +01:00
type.go Init 2022-01-15 00:09:03 +01:00

session

GitHub Workflow Status Codecov GoDoc Sourcegraph

Package session is a middleware that provides the session management for Flamego.

Installation

The minimum requirement of Go is 1.16.

go get github.com/flamego/session

Getting started

package main

import (
	"github.com/flamego/flamego"
	"github.com/flamego/session"
)

func main() {
	f := flamego.Classic()
	f.Use(session.Sessioner())
	f.Get("/", func(s session.Session) {
		s.Set("user_id", 123)
		userID, ok := s.Get("user_id").(int)
		// ...
	})
	f.Run()
}

Getting help

License

This project is under the MIT License. See the LICENSE file for the full license text.