MCPcopy Create free account
hub / github.com/astercloud/aster / GetSession

Method GetSession

pkg/workflow/workflow.go:203–221  ·  view source on GitHub ↗

GetSession 获取会话

(sessionID string)

Source from the content-addressed store, hash-verified

201
202// GetSession 获取会话
203func (w *Workflow) GetSession(sessionID string) (*WorkflowSession, error) {
204 if sessionID == "" {
205 sessionID = w.SessionID
206 }
207
208 if sessionID == "" {
209 return nil, errors.New("no session_id provided")
210 }
211
212 // 从缓存获取
213 if w.workflowSession != nil && w.workflowSession.ID == sessionID {
214 return w.workflowSession, nil
215 }
216
217 // 从数据库获取(TODO: 实现从数据库读取会话)
218 _ = w.DB // 数据库功能待实现
219
220 return nil, fmt.Errorf("session %s not found", sessionID)
221}
222
223// CreateSession 创建会话
224func (w *Workflow) CreateSession(sessionID, userID string) *WorkflowSession {

Callers 1

GetOrCreateSessionMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected