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

Function NewSQLiteSessionStoreFromDB

pkg/session/store.go:512–520  ·  view source on GitHub ↗

NewSQLiteSessionStoreFromDB wraps an already-open *sql.DB in a session store, running the bootstrap schema and migrations against it. The caller retains ownership of db: it is not closed on error, and Store.Close() will close it when the store is closed. This is intended primarily for tests that wa

(ctx context.Context, db *sql.DB)

Source from the content-addressed store, hash-verified

510// (sql.Open("sqlite", ":memory:")) or pre-seed a database with non-default
511// state. Production callers should use NewSQLiteSessionStore.
512func NewSQLiteSessionStoreFromDB(ctx context.Context, db *sql.DB) (*SQLiteSessionStore, error) {
513 if db == nil {
514 return nil, errors.New("db is nil")
515 }
516 if err := setupAndMigrate(ctx, db); err != nil {
517 return nil, err
518 }
519 return &SQLiteSessionStore{db: db}, nil
520}
521
522// openAndMigrateSQLiteStore opens the database and runs migrations
523func openAndMigrateSQLiteStore(ctx context.Context, path string) (*SQLiteSessionStore, error) {

Callers 2

openMemoryStoreFunction · 0.85

Calls 2

setupAndMigrateFunction · 0.85
NewMethod · 0.45

Tested by 2

openMemoryStoreFunction · 0.68