1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00
Files
cowyo/vendor/github.com/gin-contrib/sessions/mongo/mongo.go
2018-07-31 12:40:32 -07:00

31 lines
658 B
Go

package mongo
import (
"github.com/gin-contrib/sessions"
gsessions "github.com/gorilla/sessions"
"github.com/kidstuff/mongostore"
mgo "gopkg.in/mgo.v2"
)
type Store interface {
sessions.Store
}
func NewStore(c *mgo.Collection, maxAge int, ensureTTL bool, keyPairs ...[]byte) Store {
return &store{mongostore.NewMongoStore(c, maxAge, ensureTTL, keyPairs...)}
}
type store struct {
*mongostore.MongoStore
}
func (c *store) Options(options sessions.Options) {
c.MongoStore.Options = &gsessions.Options{
Path: options.Path,
Domain: options.Domain,
MaxAge: options.MaxAge,
Secure: options.Secure,
HttpOnly: options.HttpOnly,
}
}