nodb store for session
Go to file
Lunny Xiao be2e2aa659
Some checks failed
checks / check and test (push) Failing after 23s
Update README
2023-04-20 09:58:39 +08:00
.gitea/workflows Use actions instead of drone 2023-04-20 09:56:48 +08:00
.gitignore Implement new method Keys of Session 2020-11-10 16:31:03 +08:00
go.mod Use actions instead of drone 2023-04-20 09:56:48 +08:00
go.sum Use actions instead of drone 2023-04-20 09:56:48 +08:00
nodb_test.go Implement new method Keys of Session 2020-11-10 16:31:03 +08:00
nodb.go Implement new method Keys of Session 2020-11-10 16:31:03 +08:00
README.md Update README 2023-04-20 09:58:39 +08:00

session-nodb

Session-nodb is a store of session middleware for Tango stored session data via nodb.

Installation

go get gitea.com/tango/session-nodb

Simple Example

package main

import (
    "gitea.com/lunny/tango"
    "gitea.com/tango/session"
    "gitea.com/tango/session-nodb"
)

type SessionAction struct {
    session.Session
}

func (a *SessionAction) Get() string {
    a.Session.Set("test", "1")
    return a.Session.Get("test").(string)
}

func main() {
    o := tango.Classic()
    store, _ := nodbstore.New(nodbstore.Options{
        Path:    "./nodbstore",
        DbIndex: 0,
        MaxAge:  30 * time.Minute,
    })
    o.Use(session.New(session.Options{
        Store: store,
        }))
    o.Get("/", new(SessionAction))
}

Getting Help