2021-01-17 21:46:25 +08:00
|
|
|
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
|
2019-09-11 21:19:45 +08:00
|
|
|
//
|
|
|
|
// This Source Code Form is subject to the terms of the MIT License.
|
|
|
|
// If a copy of the MIT was not distributed with this file,
|
|
|
|
// You can obtain one at https://github.com/gogf/gf.
|
|
|
|
|
|
|
|
// Package gsession implements manager and storage features for sessions.
|
|
|
|
package gsession
|
|
|
|
|
|
|
|
import (
|
2021-07-20 23:02:02 +08:00
|
|
|
"github.com/gogf/gf/errors/gerror"
|
2020-05-16 22:08:16 +08:00
|
|
|
"github.com/gogf/gf/util/guid"
|
2019-09-11 21:19:45 +08:00
|
|
|
)
|
|
|
|
|
2019-11-05 17:33:06 +08:00
|
|
|
var (
|
2021-07-20 23:02:02 +08:00
|
|
|
ErrorDisabled = gerror.NewOption(gerror.Option{
|
|
|
|
Text: "this feature is disabled in this storage",
|
|
|
|
Code: gerror.CodeNotSupported,
|
|
|
|
})
|
2019-11-05 17:33:06 +08:00
|
|
|
)
|
|
|
|
|
2019-09-13 20:49:16 +08:00
|
|
|
// NewSessionId creates and returns a new and unique session id string,
|
2020-05-16 22:08:16 +08:00
|
|
|
// which is in 36 bytes.
|
2019-09-11 21:19:45 +08:00
|
|
|
func NewSessionId() string {
|
2020-05-16 22:08:16 +08:00
|
|
|
return guid.S()
|
2019-09-11 21:19:45 +08:00
|
|
|
}
|