MCPcopy
hub / github.com/tailscale/golink / NewSQLiteDB

Function NewSQLiteDB

db.go:51–65  ·  view source on GitHub ↗

NewSQLiteDB returns a new SQLiteDB that stores links in a SQLite database stored at f.

(f string)

Source from the content-addressed store, hash-verified

49
50// NewSQLiteDB returns a new SQLiteDB that stores links in a SQLite database stored at f.
51func NewSQLiteDB(f string) (*SQLiteDB, error) {
52 db, err := sql.Open("sqlite", f)
53 if err != nil {
54 return nil, err
55 }
56 if err := db.Ping(); err != nil {
57 return nil, err
58 }
59
60 if _, err = db.Exec(sqlSchema); err != nil {
61 return nil, err
62 }
63
64 return &SQLiteDB{db: db}, nil
65}
66
67// LoadAll returns all stored Links.
68//

Callers 8

RunFunction · 0.85
TestServeGoFunction · 0.85
TestServeSaveFunction · 0.85
TestServeDeleteFunction · 0.85
TestResolveLinkFunction · 0.85
TestNoHSTSShortDomainFunction · 0.85

Calls

no outgoing calls

Tested by 7

TestServeGoFunction · 0.68
TestServeSaveFunction · 0.68
TestServeDeleteFunction · 0.68
TestResolveLinkFunction · 0.68
TestNoHSTSShortDomainFunction · 0.68