MCPcopy Index your code
hub / github.com/docker/docker-agent / loadSession

Method loadSession

pkg/session/store.go:798–816  ·  view source on GitHub ↗

loadSession retrieves a session by ID using the supplied querier.

(ctx context.Context, q querier, id string)

Source from the content-addressed store, hash-verified

796
797// loadSession retrieves a session by ID using the supplied querier.
798func (s *SQLiteSessionStore) loadSession(ctx context.Context, q querier, id string) (*Session, error) {
799 row := q.QueryRowContext(ctx,
800 "SELECT "+sessionSelectColumns+" FROM sessions WHERE id = ?", id)
801
802 sess, err := scanSession(row)
803 if err != nil {
804 if errors.Is(err, sql.ErrNoRows) {
805 return nil, ErrNotFound
806 }
807 return nil, err
808 }
809
810 sess.Messages, err = s.loadSessionItems(ctx, q, id)
811 if err != nil {
812 return nil, fmt.Errorf("loading session items: %w", err)
813 }
814
815 return sess, nil
816}
817
818// GetSessions retrieves all root sessions (excludes sub-sessions)
819func (s *SQLiteSessionStore) GetSessions(ctx context.Context) ([]*Session, error) {

Callers 2

GetSessionMethod · 0.95
loadSessionItemsMethod · 0.95

Calls 3

loadSessionItemsMethod · 0.95
scanSessionFunction · 0.85
QueryRowContextMethod · 0.80

Tested by

no test coverage detected