-
Notifications
You must be signed in to change notification settings - Fork 555
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: allow specific sqlite engine for OpenBSD (#780)
* remove dependencies that use syscall.Syscall* OpenBSD will be removing direct access to `syscall(2)` soon. Shiori will stop working because of this, as some of its dependencies rely heavily on the use of `syscall.Syscall*`, which ends up using `syscall(2)`. This commit removes those dependencies by reverting back to use github.com/mattn/go-sqlite3 instead of modernc.org/sqlite to deal with the sqlite database backend. * add ~emersion/go-sqlite3-fts5 * enable cgo to check ci * fts5 build flag * split sqlite logic using build flags * disable cgo again * added ci test for bsd systems * remove openbsd ci * Revert "remove openbsd ci" This reverts commit f394148. * fix makefile go_test_flags --------- Co-authored-by: Felipe M <[email protected]> Co-authored-by: Felipe Martin <[email protected]>
- Loading branch information
1 parent
59a53fb
commit 02247b2
Showing
7 changed files
with
94 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//go:build linux || windows || darwin | ||
// +build linux windows darwin | ||
|
||
package database | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/jmoiron/sqlx" | ||
"github.com/pkg/errors" | ||
|
||
_ "modernc.org/sqlite" | ||
) | ||
|
||
// OpenSQLiteDatabase creates and open connection to new SQLite3 database. | ||
func OpenSQLiteDatabase(ctx context.Context, databasePath string) (sqliteDB *SQLiteDatabase, err error) { | ||
// Open database | ||
db, err := sqlx.ConnectContext(ctx, "sqlite", databasePath) | ||
if err != nil { | ||
return nil, errors.WithStack(err) | ||
} | ||
|
||
sqliteDB = &SQLiteDatabase{dbbase: dbbase{*db}} | ||
return sqliteDB, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//go:build openbsd | ||
// +build openbsd | ||
|
||
package database | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/jmoiron/sqlx" | ||
"github.com/pkg/errors" | ||
|
||
_ "git.sr.ht/~emersion/go-sqlite3-fts5" | ||
_ "github.com/mattn/go-sqlite3" | ||
) | ||
|
||
// OpenSQLiteDatabase creates and open connection to new SQLite3 database. | ||
func OpenSQLiteDatabase(ctx context.Context, databasePath string) (sqliteDB *SQLiteDatabase, err error) { | ||
// Open database | ||
db, err := sqlx.ConnectContext(ctx, "sqlite3", databasePath) | ||
if err != nil { | ||
return nil, errors.WithStack(err) | ||
} | ||
|
||
sqliteDB = &SQLiteDatabase{dbbase: dbbase{*db}} | ||
return sqliteDB, nil | ||
} |