...

Source file src/github.com/gin-contrib/sessions/mongo/mongodriver/mongodriver.go

Documentation: github.com/gin-contrib/sessions/mongo/mongodriver

     1  package mongodriver
     2  
     3  import (
     4  	"github.com/bos-hieu/mongostore"
     5  	"github.com/gin-contrib/sessions"
     6  	"go.mongodb.org/mongo-driver/mongo"
     7  )
     8  
     9  var (
    10  	_ sessions.Store = (*store)(nil)
    11  )
    12  
    13  func NewStore(c *mongo.Collection, maxAge int, ensureTTL bool, keyPairs ...[]byte) sessions.Store {
    14  	return &store{mongostore.NewMongoStore(c, maxAge, ensureTTL, keyPairs...)}
    15  }
    16  
    17  type store struct {
    18  	*mongostore.MongoStore
    19  }
    20  
    21  func (c *store) Options(options sessions.Options) {
    22  	c.MongoStore.Options = options.ToGorillaOptions()
    23  }
    24  

View as plain text