MCPcopy Create free account
hub / github.com/buggregator/server / Open

Function Open

internal/storage/sqlite.go:20–30  ·  view source on GitHub ↗

Open creates a new SQLite database connection.

(dsn string)

Source from the content-addressed store, hash-verified

18
19// Open creates a new SQLite database connection.
20func Open(dsn string) (*sql.DB, error) {
21 if dsn == ":memory:" {
22 dsn = "file::memory:?cache=shared&_pragma=journal_mode(WAL)"
23 }
24 db, err := sql.Open("sqlite", dsn)
25 if err != nil {
26 return nil, err
27 }
28 db.SetMaxOpenConns(1) // SQLite single-writer
29 return db, nil
30}
31
32func NewSQLiteStore(db *sql.DB) *SQLiteStore {
33 return &SQLiteStore{db: db}

Calls

no outgoing calls

Tested by 15

setupTestDBFunction · 0.74
setupAPITestFunction · 0.74
setupTestDBFunction · 0.74
setupTestDBFunction · 0.74
setupDBFunction · 0.74
setupAPIFunction · 0.74