MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / connection

Function connection

cli/internal/dal/init.go:129–146  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

127}
128
129func connection() (*sql.DB, error) {
130
131 dirname, err := os.UserHomeDir()
132 if err != nil {
133 log.Fatal(err)
134 }
135 sqliteFilePath := common.PathJoin(dirname, SqliteFilePath)
136
137 if !common.IsExist(sqliteFilePath) {
138 os.MkdirAll(common.PathJoin(dirname, ".ide"), os.ModePerm) // create dir
139 os.Create(sqliteFilePath)
140 }
141
142 db, err := sql.Open("sqlite3", sqliteFilePath)
143 //defer db.Close()
144
145 return db, err
146}
147
148/*
149

Callers 2

getDbFunction · 0.85
createDataTablesFunction · 0.85

Calls 2

FatalMethod · 0.80
IsExistMethod · 0.80

Tested by

no test coverage detected