sessiondb

module
v0.0.0-...-0e66430 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2021 License: Unlicense

README

sessiondb

Go Report

Dgraph & MongoDB stores for sessions of kataras/iris.

How to use

Full examples can be found in the examples folder.

Mongo

Mongo Reference

To include mongostore run

go get github.com/iris-contrib/sessiondb/mongostore
Example
	// replace with your running mongo server settings:
	cred := options.Credential{
		AuthSource: "admin",
		Username:   "user",
		Password:   "password",
	}

	clientOpts := options.Client().ApplyURI("mongodb://127.0.0.1:27017").SetAuth(cred)
	db, _ := mongostore.New(clientOpts, "sessions")

	sess := sessions.New(sessions.Config{Cookie: "sessionscookieid"})

	sess.UseDatabase(db)
Dgraph

Dgraph Reference

To include dgraphstore run

go get github.com/iris-contrib/sessiondb/dgraphstore
Example
	// replace with your server settings:
	conn, _ := grpc.Dial("127.0.0.1:9080", grpc.WithInsecure())
	db, _ := dgraphstore.NewFromDB(conn)

	sess := sessions.New(sessions.Config{Cookie: "sessionscookieid"})

	sess.UseDatabase(db)

Contribute

Development of each store is done on branches. If you plan to work with an existing store checkout the corresponding branch. If you intent to implement a new store then create a new branch named after the DB you are using.

The repository is using go-submodules. The rationale behind this optimisation is for user to avoid downloading unnecessary drivers/libraries but keep the maintenance tight and clean.

For releasing a new version of each individual store (submodule) you need to

  1. merge from corresponding branch to main
  2. tag with appropriate store name and particular store's version ie. git tag mongostore/v0.1.1

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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