MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / Create

Method Create

sqlchain/adapter/storage/sqlite3.go:49–64  ·  view source on GitHub ↗

Create implements the Storage abstraction interface.

(nodeCnt int)

Source from the content-addressed store, hash-verified

47
48// Create implements the Storage abstraction interface.
49func (s *SQLite3Storage) Create(nodeCnt int) (dbID string, err error) {
50 // generate database name
51 randBytes := make([]byte, 32)
52 if _, err = rand.Read(randBytes); err != nil {
53 return
54 }
55 dbChecksum := sha256.Sum256(randBytes)
56 dbID = hex.EncodeToString(dbChecksum[:])
57 var dbConn *sql.DB
58 if dbConn, err = s.getConn(dbID, false); err != nil {
59 return
60 }
61 defer dbConn.Close()
62
63 return
64}
65
66// Drop implements the Storage abstraction interface.
67func (s *SQLite3Storage) Drop(dbID string) (err error) {

Callers

nothing calls this directly

Calls 3

getConnMethod · 0.95
ReadMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected