Skip to content

Commit

Permalink
snapshot: stub out support for sqlite3vfshttp
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisaaronland committed Aug 11, 2021
1 parent 304efeb commit e6e97b3
Show file tree
Hide file tree
Showing 19 changed files with 1,401 additions and 5 deletions.
17 changes: 17 additions & 0 deletions database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
_ "log"
"strings"
"sync"
"github.com/psanford/sqlite3vfshttp"
"github.com/psanford/sqlite3vfs"
)

type SQLiteDatabase struct {
Expand All @@ -33,6 +35,21 @@ func NewDBWithDriver(ctx context.Context, driver string, dsn string) (*SQLiteDat

dsn = "file::memory:?mode=memory&cache=shared"

} else if strings.HasPrefix(dsn, "http") {

vfs := sqlite3vfshttp.HttpVFS{
URL: dsn,
// RoundTripper: &roundTripper{}
}

err := sqlite3vfs.RegisterVFS("httpvfs", &vfs)

if err != nil {
return nil, err
}

dsn = "not_a_real_name.db?vfs=httpvfs&mode=ro"

} else {

// https://github.com/mattn/go-sqlite3/issues/39
Expand Down
8 changes: 6 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module github.com/aaronland/go-sqlite

go 1.12
go 1.17

require github.com/mattn/go-sqlite3 v1.14.8
require (
github.com/mattn/go-sqlite3 v1.14.8
github.com/psanford/sqlite3vfs v0.0.0-20210810192024-980beb1874e4
github.com/psanford/sqlite3vfshttp v0.0.0-20210810192816-7ed3ddba507d
)
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ github.com/mattn/go-sqlite3 v1.14.8 h1:gDp86IdQsN/xWjIEmr9MF6o9mpksUgh0fu+9ByFxz
github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U=
github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/psanford/sqlite3vfs v0.0.0-20210810192024-980beb1874e4 h1:Oun5zFH1CMQCKAS4hWzHX/SaysoOAhOiDqBkKj3n1/w=
github.com/psanford/sqlite3vfs v0.0.0-20210810192024-980beb1874e4/go.mod h1:4CnLWpNEluUrLmUVLGEvkn0ZSEm9zdZmTtUlKRZp5Ag=
github.com/psanford/sqlite3vfshttp v0.0.0-20210810192816-7ed3ddba507d h1:KihA6nWlH32n8xWltDBwUWvjWk1vbclEm2TdVUr8g4U=
github.com/psanford/sqlite3vfshttp v0.0.0-20210810192816-7ed3ddba507d/go.mod h1:hQKK0GFcSapdHKElLpXRFo7SUvriHB22EuK+OQIpkuU=
3 changes: 0 additions & 3 deletions vendor/github.com/mattn/go-sqlite3/go.mod

This file was deleted.

Empty file.
21 changes: 21 additions & 0 deletions vendor/github.com/psanford/sqlite3vfs/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions vendor/github.com/psanford/sqlite3vfs/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions vendor/github.com/psanford/sqlite3vfs/defaultvfsv1.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

103 changes: 103 additions & 0 deletions vendor/github.com/psanford/sqlite3vfs/error.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

121 changes: 121 additions & 0 deletions vendor/github.com/psanford/sqlite3vfs/file.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions vendor/github.com/psanford/sqlite3vfs/options.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e6e97b3

Please sign in to comment.