Skip to content

Commit

Permalink
Split local imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
ncruces committed Oct 18, 2024
1 parent 89f750a commit ace01b2
Show file tree
Hide file tree
Showing 31 changed files with 70 additions and 39 deletions.
3 changes: 2 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package sqlite3
import (
"context"

"github.com/tetratelabs/wazero/api"

"github.com/ncruces/go-sqlite3/internal/util"
"github.com/ncruces/go-sqlite3/vfs"
"github.com/tetratelabs/wazero/api"
)

// Config makes configuration changes to a database connection.
Expand Down
3 changes: 2 additions & 1 deletion conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import (
"strings"
"time"

"github.com/tetratelabs/wazero/api"

"github.com/ncruces/go-sqlite3/internal/util"
"github.com/ncruces/go-sqlite3/vfs"
"github.com/tetratelabs/wazero/api"
)

// Conn is a database connection handle.
Expand Down
1 change: 1 addition & 0 deletions ext/bloom/bloom.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"strconv"

"github.com/dchest/siphash"

"github.com/ncruces/go-sqlite3"
"github.com/ncruces/go-sqlite3/internal/util"
)
Expand Down
9 changes: 5 additions & 4 deletions ext/hash/hash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ import (
_ "crypto/sha512"
"testing"

"github.com/ncruces/go-sqlite3/driver"
_ "github.com/ncruces/go-sqlite3/embed"
_ "github.com/ncruces/go-sqlite3/internal/testcfg"
"github.com/ncruces/go-sqlite3/vfs/memdb"
_ "golang.org/x/crypto/blake2b"
_ "golang.org/x/crypto/blake2s"
_ "golang.org/x/crypto/md4"
_ "golang.org/x/crypto/ripemd160"
_ "golang.org/x/crypto/sha3"

"github.com/ncruces/go-sqlite3/driver"
_ "github.com/ncruces/go-sqlite3/embed"
_ "github.com/ncruces/go-sqlite3/internal/testcfg"
"github.com/ncruces/go-sqlite3/vfs/memdb"
)

func TestRegister(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion ext/stats/percentile.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"math"
"slices"

"github.com/ncruces/sort/quick"

"github.com/ncruces/go-sqlite3"
"github.com/ncruces/go-sqlite3/internal/util"
"github.com/ncruces/sort/quick"
)

const (
Expand Down
5 changes: 3 additions & 2 deletions ext/unicode/unicode.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ import (
"unicode"
"unicode/utf8"

"github.com/ncruces/go-sqlite3"
"github.com/ncruces/go-sqlite3/internal/util"
"golang.org/x/text/cases"
"golang.org/x/text/collate"
"golang.org/x/text/language"
"golang.org/x/text/runes"
"golang.org/x/text/transform"
"golang.org/x/text/unicode/norm"

"github.com/ncruces/go-sqlite3"
"github.com/ncruces/go-sqlite3/internal/util"
)

// Set RegisterLike to false to not register a Unicode aware LIKE operator.
Expand Down
1 change: 1 addition & 0 deletions ext/uuid/uuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"fmt"

"github.com/google/uuid"

"github.com/ncruces/go-sqlite3"
"github.com/ncruces/go-sqlite3/internal/util"
)
Expand Down
1 change: 1 addition & 0 deletions ext/uuid/uuid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"testing"

"github.com/google/uuid"

"github.com/ncruces/go-sqlite3/driver"
_ "github.com/ncruces/go-sqlite3/embed"
_ "github.com/ncruces/go-sqlite3/internal/testcfg"
Expand Down
3 changes: 2 additions & 1 deletion func.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"context"
"sync"

"github.com/ncruces/go-sqlite3/internal/util"
"github.com/tetratelabs/wazero/api"

"github.com/ncruces/go-sqlite3/internal/util"
)

// CollationNeeded registers a callback to be invoked
Expand Down
3 changes: 2 additions & 1 deletion gormlite/error_translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package gormlite
import (
"errors"

"github.com/ncruces/go-sqlite3"
"gorm.io/gorm"

"github.com/ncruces/go-sqlite3"
)

func (_Dialector) Translate(err error) error {
Expand Down
3 changes: 2 additions & 1 deletion gormlite/error_translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package gormlite
import (
"testing"

"github.com/ncruces/go-sqlite3/vfs/memdb"
"gorm.io/gorm"
"gorm.io/gorm/logger"

"github.com/ncruces/go-sqlite3/vfs/memdb"
)

func TestErrorTranslator(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion internal/testcfg/testcfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"os"
"path/filepath"

"github.com/ncruces/go-sqlite3"
"github.com/tetratelabs/wazero"

"github.com/ncruces/go-sqlite3"
)

// notest
Expand Down
3 changes: 2 additions & 1 deletion internal/util/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package util
import (
"context"

"github.com/ncruces/go-sqlite3/internal/alloc"
"github.com/tetratelabs/wazero/experimental"

"github.com/ncruces/go-sqlite3/internal/alloc"
)

type moduleKey struct{}
Expand Down
5 changes: 3 additions & 2 deletions sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import (
"sync"
"unsafe"

"github.com/ncruces/go-sqlite3/internal/util"
"github.com/ncruces/go-sqlite3/vfs"
"github.com/tetratelabs/wazero"
"github.com/tetratelabs/wazero/api"
"github.com/tetratelabs/wazero/experimental"

"github.com/ncruces/go-sqlite3/internal/util"
"github.com/ncruces/go-sqlite3/vfs"
)

// Configure SQLite Wasm.
Expand Down
3 changes: 2 additions & 1 deletion tests/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import (
"testing"
"time"

"github.com/ncruces/julianday"

"github.com/ncruces/go-sqlite3"
"github.com/ncruces/go-sqlite3/driver"
_ "github.com/ncruces/go-sqlite3/embed"
_ "github.com/ncruces/go-sqlite3/internal/testcfg"
"github.com/ncruces/go-sqlite3/vfs/memdb"
"github.com/ncruces/julianday"
)

func TestJSON(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion time.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"strings"
"time"

"github.com/ncruces/go-sqlite3/internal/util"
"github.com/ncruces/julianday"

"github.com/ncruces/go-sqlite3/internal/util"
)

// TimeFormat specifies how to encode/decode time values.
Expand Down
3 changes: 2 additions & 1 deletion txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
"strconv"
"strings"

"github.com/ncruces/go-sqlite3/internal/util"
"github.com/tetratelabs/wazero/api"

"github.com/ncruces/go-sqlite3/internal/util"
)

// Txn is an in-progress database transaction.
Expand Down
3 changes: 2 additions & 1 deletion util/vtabutil/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (

_ "embed"

"github.com/ncruces/go-sqlite3/internal/util"
"github.com/tetratelabs/wazero"
"github.com/tetratelabs/wazero/api"

"github.com/ncruces/go-sqlite3/internal/util"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion vfs/adiantum/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
package adiantum

import (
"github.com/ncruces/go-sqlite3/vfs"
"lukechampine.com/adiantum/hbsh"

"github.com/ncruces/go-sqlite3/vfs"
)

func init() {
Expand Down
7 changes: 4 additions & 3 deletions vfs/adiantum/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import (
"log"
"os"

"github.com/ncruces/go-sqlite3"
"github.com/ncruces/go-sqlite3/vfs"
"github.com/ncruces/go-sqlite3/vfs/adiantum"
"golang.org/x/crypto/argon2"
"lukechampine.com/adiantum/hbsh"
"lukechampine.com/adiantum/hpolyc"

"github.com/ncruces/go-sqlite3"
"github.com/ncruces/go-sqlite3/vfs"
"github.com/ncruces/go-sqlite3/vfs/adiantum"
)

func ExampleRegister_hpolyc() {
Expand Down
3 changes: 2 additions & 1 deletion vfs/adiantum/hbsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"encoding/hex"
"io"

"lukechampine.com/adiantum/hbsh"

"github.com/ncruces/go-sqlite3"
"github.com/ncruces/go-sqlite3/internal/util"
"github.com/ncruces/go-sqlite3/vfs"
"lukechampine.com/adiantum/hbsh"
)

type hbshVFS struct {
Expand Down
3 changes: 2 additions & 1 deletion vfs/filename.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"context"
"net/url"

"github.com/ncruces/go-sqlite3/internal/util"
"github.com/tetratelabs/wazero/api"

"github.com/ncruces/go-sqlite3/internal/util"
)

// Filename is used by SQLite to pass filenames
Expand Down
3 changes: 2 additions & 1 deletion vfs/lock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"path/filepath"
"testing"

"github.com/ncruces/go-sqlite3/internal/util"
"github.com/tetratelabs/wazero/experimental/wazerotest"

"github.com/ncruces/go-sqlite3/internal/util"
)

func Test_vfsLock(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion vfs/readervfs/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import (

_ "embed"

"github.com/psanford/httpreadat"

_ "github.com/ncruces/go-sqlite3/driver"
_ "github.com/ncruces/go-sqlite3/embed"
"github.com/ncruces/go-sqlite3/util/ioutil"
"github.com/ncruces/go-sqlite3/vfs/readervfs"
"github.com/psanford/httpreadat"
)

func Example_http() {
Expand Down
3 changes: 2 additions & 1 deletion vfs/shm.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import (
"sync"
"time"

"github.com/ncruces/go-sqlite3/internal/util"
"github.com/tetratelabs/wazero/api"
"golang.org/x/sys/unix"

"github.com/ncruces/go-sqlite3/internal/util"
)

// SupportsSharedMemory is false on platforms that do not support shared memory.
Expand Down
3 changes: 2 additions & 1 deletion vfs/shm_bsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import (
"os"
"sync"

"github.com/ncruces/go-sqlite3/internal/util"
"github.com/tetratelabs/wazero/api"
"golang.org/x/sys/unix"

"github.com/ncruces/go-sqlite3/internal/util"
)

// SupportsSharedMemory is false on platforms that do not support shared memory.
Expand Down
9 changes: 5 additions & 4 deletions vfs/tests/mptest/mptest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ import (
"sync/atomic"
"testing"

"github.com/tetratelabs/wazero"
"github.com/tetratelabs/wazero/api"
"github.com/tetratelabs/wazero/experimental"
"github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1"

"github.com/ncruces/go-sqlite3/internal/util"
"github.com/ncruces/go-sqlite3/vfs"
_ "github.com/ncruces/go-sqlite3/vfs/adiantum"
"github.com/ncruces/go-sqlite3/vfs/memdb"
_ "github.com/ncruces/go-sqlite3/vfs/xts"
"github.com/tetratelabs/wazero"
"github.com/tetratelabs/wazero/api"
"github.com/tetratelabs/wazero/experimental"
"github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1"
)

//go:embed testdata/mptest.wasm.bz2
Expand Down
5 changes: 3 additions & 2 deletions vfs/vfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (
"reflect"
"time"

"github.com/ncruces/go-sqlite3/internal/util"
"github.com/ncruces/julianday"
"github.com/tetratelabs/wazero"
"github.com/tetratelabs/wazero/api"

"github.com/ncruces/go-sqlite3/internal/util"
"github.com/ncruces/julianday"
)

// ExportHostFunctions is an internal API users need not call directly.
Expand Down
3 changes: 2 additions & 1 deletion vfs/vfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import (
"testing"
"time"

"github.com/tetratelabs/wazero/experimental/wazerotest"

"github.com/ncruces/go-sqlite3/internal/util"
"github.com/ncruces/julianday"
"github.com/tetratelabs/wazero/experimental/wazerotest"
)

func Test_vfsLocaltime(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion vfs/xts/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
package xts

import (
"github.com/ncruces/go-sqlite3/vfs"
"golang.org/x/crypto/xts"

"github.com/ncruces/go-sqlite3/vfs"
)

func init() {
Expand Down
3 changes: 2 additions & 1 deletion vtab.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"context"
"reflect"

"github.com/ncruces/go-sqlite3/internal/util"
"github.com/tetratelabs/wazero/api"

"github.com/ncruces/go-sqlite3/internal/util"
)

// CreateModule registers a new virtual table module name.
Expand Down

0 comments on commit ace01b2

Please sign in to comment.