absences
William Perron 2 years ago
parent 3a8df77e46
commit 8ecb6ed394

2
.gitignore vendored

@ -17,3 +17,5 @@ bin/
# sqlite databases files # sqlite databases files
*.db *.db
*.db-shm
*.db-wal

@ -1,3 +1,5 @@
module go.wperron.io/themis module go.wperron.io/themis
go 1.19 go 1.19
require github.com/mattn/go-sqlite3 v1.14.15 // indirect

@ -0,0 +1,2 @@
github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI=
github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=

File diff suppressed because it is too large Load Diff

@ -0,0 +1,27 @@
package themis
import (
"database/sql"
_ "embed"
"fmt"
_ "github.com/mattn/go-sqlite3"
)
//go:embed migrations/init.sql
var initScript string
type Store struct {
db *sql.DB
}
func NewStore(conn string) (*Store, error) {
db, err := sql.Open("sqlite3", conn)
if err != nil {
return nil, fmt.Errorf("failed to open database: %w", err)
}
return &Store{
db: db,
}, nil
}
Loading…
Cancel
Save