21 lines
278 B
Go
21 lines
278 B
Go
|
package wal
|
||
|
|
||
|
import (
|
||
|
"database/sql"
|
||
|
"sync"
|
||
|
)
|
||
|
|
||
|
var initLock sync.Mutex
|
||
|
|
||
|
func initWAL(walPath string) *sql.DB {
|
||
|
initLock.Lock()
|
||
|
defer initLock.Unlock()
|
||
|
|
||
|
db, err := sql.Open("sqlite3", walPath+"?_journal=WAL")
|
||
|
must(err)
|
||
|
|
||
|
_, err = db.Exec(sqlSchema)
|
||
|
must(err)
|
||
|
return db
|
||
|
}
|