gsession.go 839 B

12345678910111213141516171819202122232425262728
  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/v2/errors/gcode"
  10. "github.com/gogf/gf/v2/errors/gerror"
  11. "github.com/gogf/gf/v2/util/guid"
  12. )
  13. var (
  14. // ErrorDisabled is used for marking certain interface function not used.
  15. ErrorDisabled = gerror.NewOption(gerror.Option{
  16. Text: "this feature is disabled in this storage",
  17. Code: gcode.CodeNotSupported,
  18. })
  19. )
  20. // NewSessionId creates and returns a new and unique session id string,
  21. // which is in 32 bytes.
  22. func NewSessionId() string {
  23. return guid.S()
  24. }