You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
themis/store.go

28 lines
386 B

2 years ago
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
}