MCPcopy
hub / github.com/hatchet-dev/hatchet / load

Method load

pkg/auth/cookie/sessionstore.go:332–354  ·  view source on GitHub ↗

load fetches a session by ID from the database and decodes its content into session.Values.

(ctx context.Context, session *sessions.Session)

Source from the content-addressed store, hash-verified

330// load fetches a session by ID from the database and decodes its content
331// into session.Values.
332func (store *UserSessionStore) load(ctx context.Context, session *sessions.Session) error {
333 sessionId, err := uuid.Parse(session.ID)
334 if err != nil {
335 return fmt.Errorf("invalid session ID: %w", err)
336 }
337
338 res, err := store.repo.GetById(ctx, sessionId)
339 if err != nil {
340 return err
341 }
342
343 data := sessionDataJSON{}
344
345 if len(res.Data) > 0 {
346 err = json.Unmarshal(res.Data, &data)
347
348 if err != nil {
349 return err
350 }
351 }
352
353 return securecookie.DecodeMulti(session.Name(), string(data.Data), &session.Values, store.codecs...)
354}
355
356// MaxLength restricts the maximum length of new sessions to l.
357// If l is 0 there is no limit to the size of a session, use with caution.

Callers 3

NewMethod · 0.95
_read_sdk_versionFunction · 0.80
handlerFunction · 0.80

Calls 4

ErrorfMethod · 0.80
GetByIdMethod · 0.65
UnmarshalMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected