Dgraph & MongoDB stores for sessions
of kataras/iris.
Full examples can be found in the examples folder.
To include mongostore
run
go get github.com/iris-contrib/sessiondb/mongostore
// 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)
To include dgraphstore
run
go get github.com/iris-contrib/sessiondb/dgraphstore
// 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)
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
- merge from corresponding branch to
main
- tag with appropriate store name and particular store's version ie.
git tag mongostore/v0.1.1