Skip to content

Commit

Permalink
Fix other libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
zikaeroh committed Sep 26, 2020
1 parent e5bfb54 commit 474e84e
Show file tree
Hide file tree
Showing 16 changed files with 68 additions and 214 deletions.
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ require (
github.com/gofrs/uuid v3.3.0+incompatible // indirect
github.com/jinzhu/gorm v1.9.12
github.com/jmoiron/sqlx v1.2.0
github.com/lib/pq v1.7.0
github.com/satori/go.uuid v1.2.0 // indirect
github.com/spf13/viper v1.7.0 // indirect
github.com/volatiletech/null/v8 v8.1.0
github.com/volatiletech/sqlboiler/v4 v4.2.0
github.com/volatiletech/strmangle v0.0.1
Expand All @@ -19,6 +17,5 @@ require (
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect
gopkg.in/gorp.v1 v1.7.2
gopkg.in/src-d/go-kallax.v1 v1.3.5
xorm.io/core v0.7.3
xorm.io/xorm v1.0.1
xorm.io/xorm v1.0.2
)
143 changes: 6 additions & 137 deletions go.sum

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions gorms/gorm.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ package gorms

import (
"github.com/volatiletech/null/v8"

// Shutup linter
_ "github.com/lib/pq"
)

// Pilot struct
Expand Down
3 changes: 0 additions & 3 deletions gorps/gorp.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ package gorps

import (
"github.com/volatiletech/null/v8"

// Shutup linter
_ "github.com/lib/pq"
)

// Pilot struct
Expand Down
5 changes: 2 additions & 3 deletions insert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import (
"database/sql"
"testing"

"github.com/volatiletech/sqlboiler/v4/boil"

"github.com/jinzhu/gorm"
"github.com/volatiletech/boilbench/gorms"
"github.com/volatiletech/boilbench/gorps"
"github.com/volatiletech/boilbench/kallaxes"
"github.com/volatiletech/boilbench/mimic"
"github.com/volatiletech/boilbench/models"
"github.com/volatiletech/boilbench/xorms"
"github.com/volatiletech/sqlboiler/v4/boil"
"gopkg.in/gorp.v1"
"gopkg.in/src-d/go-kallax.v1"
"xorm.io/xorm"
Expand All @@ -24,7 +23,7 @@ func BenchmarkGORMInsert(b *testing.B) {
ID: 1,
}

exec := jetExec()
exec := jetQueryInsert()
exec.NumInput = -1
mimic.NewResult(exec)

Expand Down
15 changes: 10 additions & 5 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"os"
"testing"

"github.com/jinzhu/gorm"
"github.com/volatiletech/boilbench/mimic"
"xorm.io/core"
"xorm.io/xorm/dialects"
)

Expand Down Expand Up @@ -143,12 +143,17 @@ func jetExecUpdate() mimic.QueryResult {
}

func TestMain(m *testing.M) {
// Register the mimic driver for Xorm
core.RegisterDriver("mimic", &mimic.XormDriver{})
if core.QueryDriver("mimic") == nil {
dialects.RegisterDriver("mimic", &mimic.XormDriver{})
if dialects.QueryDriver("mimic") == nil {
panic("failed to register xorm driver")
}
dialects.RegisterDriver("mimic", &mimic.XormDialectDriver{})

if dialect, ok := gorm.GetDialect("postgres"); ok {
gorm.RegisterDialect("mimic", dialect)
} else {
panic("failed to register gorm dialect")
}

code := m.Run()
os.Exit(code)
}
17 changes: 5 additions & 12 deletions mimic/mimic.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,18 @@ import (
"errors"
"io"
"strconv"
"xorm.io/xorm/dialects"

"xorm.io/core"
"xorm.io/xorm/dialects"
"xorm.io/xorm/schemas"
)

var dsns = map[string]QueryResult{}
var counter = 0

type XormDriver struct {
}

func (x *XormDriver) Parse(a string, b string) (*core.Uri, error) {
return &core.Uri{DbType: core.POSTGRES}, nil
}

type XormDialectDriver struct{}
type XormDriver struct{}

func (x *XormDialectDriver) Parse(string, string) (*dialects.URI, error) {
return &dialects.URI{DBType: core.POSTGRES}, nil
func (x *XormDriver) Parse(string, string) (*dialects.URI, error) {
return &dialects.URI{DBType: schemas.POSTGRES}, nil
}

type QueryResult struct {
Expand Down
6 changes: 3 additions & 3 deletions mimic/mimic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ func TestIt(t *testing.T) {
Query: &Query{
Cols: []string{"id"},
Vals: [][]driver.Value{
[]driver.Value{
{
int64(56),
},
[]driver.Value{
{
int64(76),
},
[]driver.Value{
{
int64(333),
},
},
Expand Down
10 changes: 5 additions & 5 deletions models/airports.go

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

8 changes: 4 additions & 4 deletions models/hangars.go

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

28 changes: 14 additions & 14 deletions models/jets.go

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

10 changes: 5 additions & 5 deletions models/languages.go

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

10 changes: 5 additions & 5 deletions models/licenses.go

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

14 changes: 7 additions & 7 deletions models/pilots.go

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

2 changes: 1 addition & 1 deletion scripts/gen-models
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ echo "Waiting for container to be ready"
while ! curl http://localhost:5432 2>&1 | grep -q '52'; do sleep 1; done

echo "Generating models"
go run github.com/volatiletech/sqlboiler/v4 ./scripts/sqlboiler-psql --wipe --no-tests
go run github.com/volatiletech/sqlboiler/v4 ./scripts/sqlboiler-psql --wipe --no-tests --tag db
3 changes: 0 additions & 3 deletions xorms/xorm.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ package xorms

import (
"github.com/volatiletech/null/v8"

// Shutup linter
_ "github.com/lib/pq"
)

// Pilot struct
Expand Down

0 comments on commit 474e84e

Please sign in to comment.