Skip to content

Commit

Permalink
use mattn's sqlite library
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Jul 21, 2024
1 parent 9779167 commit f389fa2
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 147 deletions.
4 changes: 2 additions & 2 deletions auth/auth_migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"database/sql"
"testing"

_ "modernc.org/sqlite"
_ "github.com/mattn/go-sqlite3"

"github.com/minetest-go/mtdb/auth"
"github.com/minetest-go/mtdb/types"
Expand All @@ -13,7 +13,7 @@ import (

func TestMigrateAuthSQlite(t *testing.T) {
// open db
db, err := sql.Open("sqlite", ":memory:")
db, err := sql.Open("sqlite3", ":memory:")
assert.NoError(t, err)

assert.NoError(t, auth.MigrateAuthDB(db, types.DATABASE_SQLITE))
Expand Down
10 changes: 5 additions & 5 deletions auth/auth_sqlite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

_ "modernc.org/sqlite"
_ "github.com/mattn/go-sqlite3"

"github.com/minetest-go/mtdb/auth"
"github.com/minetest-go/mtdb/types"
Expand All @@ -15,7 +15,7 @@ import (

func TestEmptySQliteRepo(t *testing.T) {
// open db
db, err := sql.Open("sqlite", ":memory:")
db, err := sql.Open("sqlite3", ":memory:")
assert.NoError(t, err)
repo := auth.NewAuthRepository(db, types.DATABASE_SQLITE)
assert.NotNil(t, repo)
Expand All @@ -33,7 +33,7 @@ func TestSQliteRepo(t *testing.T) {
copyFileContents("testdata/auth.wal.sqlite", dbfile.Name())

// open db
db, err := sql.Open("sqlite", "file:"+dbfile.Name())
db, err := sql.Open("sqlite3", "file:"+dbfile.Name())
assert.NoError(t, err)
repo := auth.NewAuthRepository(db, types.DATABASE_SQLITE)
assert.NotNil(t, repo)
Expand Down Expand Up @@ -99,7 +99,7 @@ func TestSQlitePrivRepo(t *testing.T) {
copyFileContents("testdata/auth.wal.sqlite", dbfile.Name())

// open db
db, err := sql.Open("sqlite", "file:"+dbfile.Name())
db, err := sql.Open("sqlite3", "file:"+dbfile.Name())
assert.NoError(t, err)
repo := auth.NewPrivilegeRepository(db, types.DATABASE_SQLITE)
assert.NotNil(t, repo)
Expand Down Expand Up @@ -155,7 +155,7 @@ func TestSqliteAuthRepo(t *testing.T) {
dbfile, err := os.CreateTemp(os.TempDir(), "auth.sqlite")
assert.NoError(t, err)
assert.NotNil(t, dbfile)
db, err := sql.Open("sqlite", "file:"+dbfile.Name())
db, err := sql.Open("sqlite3", "file:"+dbfile.Name())
assert.NoError(t, err)
assert.NoError(t, auth.MigrateAuthDB(db, types.DATABASE_SQLITE))
assert.NoError(t, wal.EnableWAL(db))
Expand Down
4 changes: 2 additions & 2 deletions block/block_migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"database/sql"
"testing"

_ "modernc.org/sqlite"
_ "github.com/mattn/go-sqlite3"

"github.com/minetest-go/mtdb/block"
"github.com/minetest-go/mtdb/types"
Expand All @@ -13,7 +13,7 @@ import (

func TestMigrateBlockSQlite(t *testing.T) {
// open db
db, err := sql.Open("sqlite", ":memory:")
db, err := sql.Open("sqlite3", ":memory:")
assert.NoError(t, err)

assert.NoError(t, block.MigrateBlockDB(db, types.DATABASE_SQLITE))
Expand Down
4 changes: 2 additions & 2 deletions block/block_sqlite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

_ "modernc.org/sqlite"
_ "github.com/mattn/go-sqlite3"

"github.com/minetest-go/mtdb/block"
"github.com/minetest-go/mtdb/types"
Expand All @@ -17,7 +17,7 @@ func setupSqlite(t *testing.T) (block.BlockRepository, *sql.DB) {
dbfile, err := os.CreateTemp(os.TempDir(), "map.sqlite")
assert.NoError(t, err)
assert.NotNil(t, dbfile)
db, err := sql.Open("sqlite", "file:"+dbfile.Name())
db, err := sql.Open("sqlite3", "file:"+dbfile.Name())
assert.NoError(t, err)
assert.NoError(t, wal.EnableWAL(db))

Expand Down
7 changes: 4 additions & 3 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"path"

_ "github.com/lib/pq"
_ "github.com/mattn/go-sqlite3"

"github.com/minetest-go/mtdb/auth"
"github.com/minetest-go/mtdb/block"
"github.com/minetest-go/mtdb/mod_storage"
Expand All @@ -15,7 +17,6 @@ import (
"github.com/minetest-go/mtdb/wal"
"github.com/minetest-go/mtdb/worldconfig"
"github.com/sirupsen/logrus"
_ "modernc.org/sqlite"
)

// Database connection context
Expand Down Expand Up @@ -84,15 +85,15 @@ func connectAndMigrate(opts *connectMigrateOpts) (*sql.DB, error) {
default:
// default to sqlite
datasource = opts.SQliteConnection
dbtype = "sqlite"
dbtype = "sqlite3"
}

if opts.Type == types.DATABASE_POSTGRES && datasource == "" {
// pg connection unconfigured
return nil, nil
}

db, err := sql.Open(string(dbtype), datasource)
db, err := sql.Open(dbtype, fmt.Sprintf("%s?_timeout=5000&_journal=WAL&_cache=shared", datasource))
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"

_ "github.com/lib/pq"
_ "modernc.org/sqlite"
_ "github.com/mattn/go-sqlite3"

"github.com/minetest-go/mtdb"
"github.com/stretchr/testify/assert"
Expand Down
22 changes: 1 addition & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,14 @@ go 1.22

require (
github.com/lib/pq v1.10.9
github.com/mattn/go-sqlite3 v1.14.22
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.9.0
modernc.org/sqlite v1.30.1
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/tools v0.19.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/uint128 v1.2.0 // indirect
modernc.org/cc/v3 v3.41.0 // indirect
modernc.org/ccgo/v3 v3.17.0 // indirect
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect
modernc.org/libc v1.52.1 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.8.0 // indirect
modernc.org/opt v0.1.3 // indirect
modernc.org/strutil v1.2.0 // indirect
modernc.org/token v1.1.0 // indirect
)
100 changes: 2 additions & 98 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,119 +1,23 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ=
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78 h1:M8tBwCtWD/cZV9DZpFYRUgaymAYAr+aIUTWzDaM3uPs=
golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
lukechampine.com/uint128 v1.2.0 h1:mBi/5l91vocEN8otkC5bDLhi2KdCticRiwbdB0O+rjI=
lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
modernc.org/cc/v3 v3.40.0 h1:P3g79IUS/93SYhtoeaHW+kRCIrYaxJ27MFPv+7kaTOw=
modernc.org/cc/v3 v3.40.0/go.mod h1:/bTg4dnWkSXowUO6ssQKnOV0yMVxDYNIsIrzqTFDGH0=
modernc.org/cc/v3 v3.41.0/go.mod h1:Ni4zjJYJ04CDOhG7dn640WGfwBzfE0ecX8TyMB0Fv0Y=
modernc.org/ccgo/v3 v3.16.13 h1:Mkgdzl46i5F/CNR/Kj80Ri59hC8TKAhZrYSaqvkwzUw=
modernc.org/ccgo/v3 v3.16.13/go.mod h1:2Quk+5YgpImhPjv2Qsob1DnZ/4som1lJTodubIcoUkY=
modernc.org/ccgo/v3 v3.17.0/go.mod h1:Sg3fwVpmLvCUTaqEUjiBDAvshIaKDB0RXaf+zgqFu8I=
modernc.org/ccorpus v1.11.6 h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk=
modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ=
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 h1:5D53IMaUuA5InSeMu9eJtlQXS2NxAhyWQvkKEgXZhHI=
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4=
modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM=
modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM=
modernc.org/libc v1.29.0 h1:tTFRFq69YKCF2QyGNuRUQxKBm1uZZLubf6Cjh/pVHXs=
modernc.org/libc v1.29.0/go.mod h1:DaG/4Q3LRRdqpiLyP0C2m1B8ZMGkQ+cCgOIjEtQlYhQ=
modernc.org/libc v1.52.1 h1:uau0VoiT5hnR+SpoWekCKbLqm7v6dhRL3hI+NQhgN3M=
modernc.org/libc v1.52.1/go.mod h1:HR4nVzFDSDizP620zcMCgjb1/8xk2lg5p/8yjfGv1IQ=
modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=
modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo=
modernc.org/memory v1.7.2 h1:Klh90S215mmH8c9gO98QxQFsY+W451E8AnzjoE2ee1E=
modernc.org/memory v1.7.2/go.mod h1:NO4NVCQy0N7ln+T9ngWqOQfi7ley4vpwvARR+Hjw95E=
modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E=
modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU=
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
modernc.org/sqlite v1.27.0 h1:MpKAHoyYB7xqcwnUwkuD+npwEa0fojF0B5QRbN+auJ8=
modernc.org/sqlite v1.27.0/go.mod h1:Qxpazz0zH8Z1xCFyi5GSL3FzbtZ3fvbjmywNogldEW0=
modernc.org/sqlite v1.30.1 h1:YFhPVfu2iIgUf9kuA1CR7iiHdcEEsI2i+yjRYHscyxk=
modernc.org/sqlite v1.30.1/go.mod h1:DUmsiWQDaAvU4abhc/N+djlom/L2o8f7gZ95RCvyoLU=
modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY=
modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw=
modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA=
modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0=
modernc.org/tcl v1.15.2 h1:C4ybAYCGJw968e+Me18oW55kD/FexcHbqH2xak1ROSY=
modernc.org/tcl v1.15.2/go.mod h1:3+k/ZaEbKrC8ePv8zJWPtBSW0V7Gg9g8rkmhI1Kfs3c=
modernc.org/token v1.0.1 h1:A3qvTqOwexpfZZeyI0FeGPDlSWX5pjZu9hF4lU+EKWg=
modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
modernc.org/z v1.7.3 h1:zDJf6iHjrnB+WRD88stbXokugjyc0/pB91ri1gO6LZY=
modernc.org/z v1.7.3/go.mod h1:Ipv4tsdxZRbQyLq9Q1M6gdbkxYzdlrciF2Hi/lS7nWE=
4 changes: 2 additions & 2 deletions mod_storage/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"database/sql"
"testing"

_ "modernc.org/sqlite"
_ "github.com/mattn/go-sqlite3"

"github.com/minetest-go/mtdb/mod_storage"
"github.com/minetest-go/mtdb/types"
Expand All @@ -13,7 +13,7 @@ import (

func TestMigrateModStorageSQlite(t *testing.T) {
// open db
db, err := sql.Open("sqlite", ":memory:")
db, err := sql.Open("sqlite3", ":memory:")
assert.NoError(t, err)

assert.NoError(t, mod_storage.MigrateModStorageDB(db, types.DATABASE_SQLITE))
Expand Down
4 changes: 2 additions & 2 deletions mod_storage/sqlite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os"
"testing"

_ "modernc.org/sqlite"
_ "github.com/mattn/go-sqlite3"

"github.com/minetest-go/mtdb/mod_storage"
"github.com/minetest-go/mtdb/types"
Expand All @@ -22,7 +22,7 @@ func TestModStorageSQliteRepo(t *testing.T) {
copyFileContents("testdata/mod_storage.sqlite", dbfile.Name())

// open db
db, err := sql.Open("sqlite", "file:"+dbfile.Name())
db, err := sql.Open("sqlite3", "file:"+dbfile.Name())
assert.NoError(t, err)
repo := mod_storage.NewModStorageRepository(db, types.DATABASE_SQLITE)
assert.NotNil(t, repo)
Expand Down
2 changes: 1 addition & 1 deletion player/player_search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func testPlayerSearch(t *testing.T, repo *player.PlayerRepository) {

func TestPlayerSearchSQLite(t *testing.T) {
// open db
db, err := sql.Open("sqlite", ":memory:")
db, err := sql.Open("sqlite3", ":memory:")
assert.NoError(t, err)

assert.NoError(t, player.MigratePlayerDB(db, types.DATABASE_SQLITE))
Expand Down
8 changes: 4 additions & 4 deletions player/player_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"testing"

_ "github.com/lib/pq"
_ "modernc.org/sqlite"
_ "github.com/mattn/go-sqlite3"

"github.com/minetest-go/mtdb/player"
"github.com/minetest-go/mtdb/types"
Expand Down Expand Up @@ -48,7 +48,7 @@ func testRepository(t *testing.T, repo *player.PlayerRepository) {

func TestSQliteMigratePlayer(t *testing.T) {
// open db
db, err := sql.Open("sqlite", ":memory:")
db, err := sql.Open("sqlite3", ":memory:")
assert.NoError(t, err)

assert.NoError(t, player.MigratePlayerDB(db, types.DATABASE_SQLITE))
Expand All @@ -62,7 +62,7 @@ func TestSqlitePlayerRepo(t *testing.T) {
copyFileContents("testdata/players.sqlite", dbfile.Name())

// open db
db, err := sql.Open("sqlite", "file:"+dbfile.Name())
db, err := sql.Open("sqlite3", "file:"+dbfile.Name())
assert.NoError(t, err)
assert.NoError(t, player.MigratePlayerDB(db, types.DATABASE_SQLITE))
repo := player.NewPlayerRepository(db, types.DATABASE_SQLITE)
Expand Down Expand Up @@ -117,7 +117,7 @@ func TestSqlitePlayerRepo(t *testing.T) {

func TestSQlitePlayerRepo2(t *testing.T) {
// open db
db, err := sql.Open("sqlite", ":memory:")
db, err := sql.Open("sqlite3", ":memory:")
assert.NoError(t, err)

assert.NoError(t, player.MigratePlayerDB(db, types.DATABASE_SQLITE))
Expand Down
2 changes: 1 addition & 1 deletion player/playermetadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func testPlayerMetadata(t *testing.T, repo *player.PlayerMetadataRepository, pre
func TestPlayerMetadataSQlite(t *testing.T) {
dbfile, err := os.CreateTemp(os.TempDir(), "playermetadata.sqlite")
assert.NoError(t, err)
db, err := sql.Open("sqlite", dbfile.Name())
db, err := sql.Open("sqlite3", dbfile.Name())
assert.NoError(t, err)

assert.NoError(t, player.MigratePlayerDB(db, types.DATABASE_SQLITE))
Expand Down
Loading

0 comments on commit f389fa2

Please sign in to comment.