-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kv/sqlite3: workaround for modernc/sqlite3 not building on illumos
- Loading branch information
1 parent
20ea126
commit 49bb64f
Showing
3 changed files
with
39 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//go:build illumos | ||
|
||
package sqlite3 | ||
|
||
import ( | ||
"errors" | ||
|
||
"gorm.io/gorm" | ||
) | ||
|
||
// FIXME: Introduce support for SQLite3 via mattn/go-sqlite3 | ||
func openSQLite(_ string) (gorm.Dialector, error) { | ||
return nil, errors.ErrUnsupported | ||
} |
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,16 @@ | ||
//go:build !illumos | ||
|
||
package sqlite3 | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/glebarez/sqlite" | ||
"gorm.io/gorm" | ||
) | ||
|
||
func openSQLite(dbpath string) (gorm.Dialector, error) { | ||
dsn := fmt.Sprintf("file:%s?_pragma=journal_mode(WAL)&_pragma=foreign_keys(1)&_pragma=busy_timeout(5000)&_pragma=synchronous(1)&_pragma=page_size(4096)&_txlock=immediate", dbpath) | ||
db := sqlite.Open(dsn) | ||
return db, nil | ||
} |