GAAS GFrame项目web后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
647 B

// Copyright (c) Shenyang Leading Edge Intelligent Technology Co., Ltd. All rights reserved.
package container
import (
"errors"
"fmt"
)
// 会话上下文
type SessionContext struct {
// 用户标识
userId string
}
// 创建会话上下文
// 参数
// 1.用户标识
// 返回值:
// 1.会话上下文
// 2.错误
func NewSessionContext(userId string) (*SessionContext, error) {
if userId == "" {
return nil, errors.New(fmt.Sprintf("用户标识不能为空!"))
}
return &SessionContext{userId}, nil
}
// 获取用户标识
// 返回值:
// 1.用户标识
func (context *SessionContext) UserId() string {
return context.userId
}