gsession.go 755 B

123456789101112131415161718192021222324252627
  1. // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
  2. //
  3. // This Source Code Form is subject to the terms of the MIT License.
  4. // If a copy of the MIT was not distributed with this file,
  5. // You can obtain one at https://github.com/gogf/gf.
  6. // Package gsession implements manager and storage features for sessions.
  7. package gsession
  8. import (
  9. "github.com/gogf/gf/errors/gcode"
  10. "github.com/gogf/gf/errors/gerror"
  11. "github.com/gogf/gf/util/guid"
  12. )
  13. var (
  14. ErrorDisabled = gerror.NewOption(gerror.Option{
  15. Text: "this feature is disabled in this storage",
  16. Code: gcode.CodeNotSupported,
  17. })
  18. )
  19. // NewSessionId creates and returns a new and unique session id string,
  20. // which is in 36 bytes.
  21. func NewSessionId() string {
  22. return guid.S()
  23. }