MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / NewSession

Function NewSession

cmd/cql-proxy/model/session.go:282–299  ·  view source on GitHub ↗

NewSession created and save new session to database.

(db *gorp.DbMap, expire int64)

Source from the content-addressed store, hash-verified

280
281// NewSession created and save new session to database.
282func NewSession(db *gorp.DbMap, expire int64) (s *Session, err error) {
283 id := uuid.Must(uuid.NewV4()).String()
284 now := time.Now().Unix()
285 s = &Session{
286 ID: id,
287 Created: now,
288 Expire: now + expire,
289 Store: gin.H{},
290 }
291
292 err = db.Insert(s)
293 if err != nil {
294 err = errors.Wrapf(err, "new session failed")
295 return
296 }
297
298 return
299}
300
301// GetSession returns session object of specified session id.
302func GetSession(db *gorp.DbMap, id string) (s *Session, err error) {

Callers 3

adminOAuthCallbackFunction · 0.92
SaveSessionFunction · 0.85

Calls 2

InsertMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected