sessionbolt

package module
v0.0.0-...-bb33541 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package sessionbolt provides a BoltDB store for sessions.

It uses go.etcd.io/bbolt package as a backend.

Example:

db, err := bbolt.Open("db.boltdb", 0666, nil)
if err != nil {
  return err
}
defer db.Close()

store := New(db, "sessions")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store is a session store that uses BoltDB as backend.

func New

func New(db *bbolt.DB, bucket string) *Store

New creates a new BoltDB store with alredy opened BoltDB.

func (*Store) Del

func (s *Store) Del(ctx context.Context, key string) error

Del deletes a session in DB.

func (*Store) Get

func (s *Store) Get(ctx context.Context, key string) ([]byte, error)

Get get a session from DB by key.

func (*Store) Set

func (s *Store) Set(ctx context.Context, key string, value []byte) error

Set saves a session in DB

Jump to

Keyboard shortcuts

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