firestoregorilla

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2019 License: Apache-2.0 Imports: 8 Imported by: 4

README

Firestore Gorilla

This project contains a gorilla/sessions.Store implementation backed by Firestore.

Disclaimer

This is not an officially supported Google product.

Documentation

Overview

Package firestoregorilla is a Firestore-backed sessions store, which can be used with gorilla/sessions.

Encoded sessions are stored in Firestore and session IDs are stored in secure cookies.

Sessions never expire and are never deleted or cleaned up.

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 Firestore-backed sessions store.

func New

func New(ctx context.Context, client *firestore.Client) (*Store, error)

New creates a new Store.

Only string key values are supported for sessions.

func (*Store) Get

func (s *Store) Get(r *http.Request, name string) (*sessions.Session, error)

Get returns a cached session, if it exists. Otherwise, Get returns a new session.

The name is used as the cookie name and Firestore collection name, so different apps in the same Google Cloud project should use different names.

func (*Store) New

func (s *Store) New(r *http.Request, name string) (*sessions.Session, error)

New creates and returns a new session.

If the session already exists, it will be returned.

The name is used as the cookie name and Firestore collection name, so different apps in the same Google Cloud project should use different names.

func (*Store) Save

func (s *Store) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error

Save persists the session to Firestore and the session ID in a cookie.

Jump to

Keyboard shortcuts

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