github.com/wangyougui/gf/v2@v2.6.5/os/gsession/gsession.go (about)

     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/wangyougui/gf.
     6  
     7  // Package gsession implements manager and storage features for sessions.
     8  package gsession
     9  
    10  import (
    11  	"github.com/wangyougui/gf/v2/errors/gcode"
    12  	"github.com/wangyougui/gf/v2/errors/gerror"
    13  	"github.com/wangyougui/gf/v2/util/guid"
    14  )
    15  
    16  var (
    17  	// ErrorDisabled is used for marking certain interface function not used.
    18  	ErrorDisabled = gerror.NewWithOption(gerror.Option{
    19  		Text: "this feature is disabled in this storage",
    20  		Code: gcode.CodeNotSupported,
    21  	})
    22  )
    23  
    24  // NewSessionId creates and returns a new and unique session id string,
    25  // which is in 32 bytes.
    26  func NewSessionId() string {
    27  	return guid.S()
    28  }