diff --git a/delete_test.go b/delete_test.go index de9ded0..30f60bc 100644 --- a/delete_test.go +++ b/delete_test.go @@ -3,9 +3,12 @@ package main import ( "context" "database/sql" - "github.com/gobuffalo/pop/v6" "testing" + "github.com/gobuffalo/pop/v6" + "github.com/olachat/gola/coredb" + + golas "github.com/volatiletech/boilbench/gola" "github.com/volatiletech/boilbench/gorms" "github.com/volatiletech/boilbench/gorps" "github.com/volatiletech/boilbench/mimic" @@ -41,6 +44,32 @@ func BenchmarkGORMDelete(b *testing.B) { }) } +func BenchmarkGOLADelete(b *testing.B) { + pk := 1 + + exec := jetExec() + exec.NumInput = -1 + mimic.NewResult(exec) + + db, err := sql.Open("mimic", "") + if err != nil { + panic(err) + } + + coredb.Setup(func(_ string, _ coredb.DBMode) *sql.DB { + return db + }) + + b.Run("gola", func(b *testing.B) { + for i := 0; i < b.N; i++ { + err := golas.DeleteByPK(pk) + if err != nil { + b.Fatal(err) + } + } + }) +} + func BenchmarkGORPDelete(b *testing.B) { store := gorps.Jet{ ID: 1, diff --git a/go.mod b/go.mod index 1d99dfb..791a83f 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,12 @@ module github.com/volatiletech/boilbench -go 1.14 +go 1.18 require ( github.com/friendsofgo/errors v0.9.2 - github.com/gobuffalo/pop/v6 v6.0.1 // indirect + github.com/gobuffalo/pop/v6 v6.0.1 github.com/jmoiron/sqlx v1.3.4 + github.com/olachat/gola v0.0.0-20220823103703-50fed997fe38 github.com/volatiletech/null/v8 v8.1.0 github.com/volatiletech/sqlboiler/v4 v4.2.0 github.com/volatiletech/strmangle v0.0.1 @@ -14,3 +15,70 @@ require ( gorm.io/gorm v1.20.2 xorm.io/xorm v1.0.5 ) + +require ( + github.com/Masterminds/semver/v3 v3.1.1 // indirect + github.com/aymerick/douceur v0.2.0 // indirect + github.com/fatih/color v1.13.0 // indirect + github.com/fatih/structs v1.1.0 // indirect + github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/go-sql-driver/mysql v1.6.0 // indirect + github.com/gobuffalo/envy v1.10.1 // indirect + github.com/gobuffalo/fizz v1.14.0 // indirect + github.com/gobuffalo/flect v0.2.4 // indirect + github.com/gobuffalo/github_flavored_markdown v1.1.1 // indirect + github.com/gobuffalo/helpers v0.6.4 // indirect + github.com/gobuffalo/nulls v0.4.1 // indirect + github.com/gobuffalo/plush/v4 v4.1.9 // indirect + github.com/gobuffalo/tags/v3 v3.1.2 // indirect + github.com/gobuffalo/validate/v3 v3.3.1 // indirect + github.com/gofrs/uuid v4.1.0+incompatible // indirect + github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect + github.com/gorilla/css v1.0.0 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/jackc/chunkreader/v2 v2.0.1 // indirect + github.com/jackc/pgconn v1.10.1 // indirect + github.com/jackc/pgio v1.0.0 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgproto3/v2 v2.1.1 // indirect + github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect + github.com/jackc/pgtype v1.8.1 // indirect + github.com/jackc/pgx/v4 v4.13.0 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.1 // indirect + github.com/joho/godotenv v1.4.0 // indirect + github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect + github.com/lib/pq v1.10.4 // indirect + github.com/luna-duclos/instrumentedsql v1.1.3 // indirect + github.com/magiconair/properties v1.8.5 // indirect + github.com/mattn/go-colorable v0.1.9 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/mattn/go-sqlite3 v1.14.9 // indirect + github.com/microcosm-cc/bluemonday v1.0.16 // indirect + github.com/mitchellh/mapstructure v1.4.1 // indirect + github.com/pelletier/go-toml v1.9.3 // indirect + github.com/rogpeppe/go-internal v1.8.0 // indirect + github.com/sergi/go-diff v1.2.0 // indirect + github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d // indirect + github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e // indirect + github.com/spf13/afero v1.6.0 // indirect + github.com/spf13/cast v1.3.1 // indirect + github.com/spf13/cobra v1.2.1 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/viper v1.8.1 // indirect + github.com/subosito/gotenv v1.2.0 // indirect + github.com/syndtr/goleveldb v1.0.0 // indirect + github.com/volatiletech/inflect v0.0.1 // indirect + github.com/volatiletech/randomize v0.0.1 // indirect + golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + gopkg.in/ini.v1 v1.62.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + xorm.io/builder v0.3.7 // indirect +) diff --git a/go.sum b/go.sum index 01466a5..acb2505 100644 --- a/go.sum +++ b/go.sum @@ -39,7 +39,6 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s= gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.4.1 h1:ThlnYciV1iM/V0OSF/dtkqWb6xo5qITT1TJBG1MRDJM= @@ -108,8 +107,8 @@ github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/friendsofgo/errors v0.9.2 h1:X6NYxef4efCBdwI7BgS820zFaN7Cphrmb+Pljdzjtgk= github.com/friendsofgo/errors v0.9.2/go.mod h1:yCvFW5AkDIL9qn7suHVLiI/gH228n7PC4Pn44IGoTOI= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -120,8 +119,6 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -159,7 +156,6 @@ github.com/gobuffalo/validate/v3 v3.0.0/go.mod h1:HFpjq+AIiA2RHoQnQVTFKF/ZpUPXwy github.com/gobuffalo/validate/v3 v3.3.1 h1:5YLQL22YARUsYS5ZGsPU6TrD0Utiu53N1JJ5qi+foYk= github.com/gobuffalo/validate/v3 v3.3.1/go.mod h1:Ehu8ieNJQuUM4peDDr/0VapzdGA7RgTc3wbe51vHfS0= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.1.0+incompatible h1:sIa2eCvUTwgjbqXrPLfNwUf9S3i3mpH1O1atV+iL/Wk= @@ -182,7 +178,6 @@ github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= @@ -269,7 +264,6 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= @@ -280,7 +274,6 @@ github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsU github.com/jackc/pgconn v1.4.0/go.mod h1:Y2O3ZDF0q4mMacyWV3AstPJpeHXWGEetiFttmq5lahk= github.com/jackc/pgconn v1.5.0/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= github.com/jackc/pgconn v1.5.1-0.20200601181101-fa742c524853/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= -github.com/jackc/pgconn v1.7.0 h1:pwjzcYyfmz/HQOQlENvG1OcDqauTGaqlVahq934F0/U= github.com/jackc/pgconn v1.7.0/go.mod h1:sF/lPpNEMEOp+IYhyQGdAvrG20gWf6A1tKlr0v7JMeA= github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= @@ -290,20 +283,18 @@ github.com/jackc/pgconn v1.10.1 h1:DzdIHIjG1AxGwoEEqS+mGsURyjt4enSmqzACXvVzOT8= github.com/jackc/pgconn v1.10.1/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= -github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2 h1:JVX6jT/XfzNqIjye4717ITLaNwV9mWbJx0dLCpcRzdA= github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c= +github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5Wi/+Zz7xoE5ALHsRQlOctkOiHc= github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= -github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A= github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgproto3/v2 v2.0.5 h1:NUbEWPmCQZbMmYlTjVoNPhc0CfnYyz2bfUAh6A5ZVJM= github.com/jackc/pgproto3/v2 v2.0.5/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgproto3/v2 v2.1.1 h1:7PQ/4gLoqnl87ZxL7xjO0DR5gYuviDCZxQJsUlFW1eI= @@ -317,7 +308,6 @@ github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrU github.com/jackc/pgtype v1.2.0/go.mod h1:5m2OfMh1wTK7x+Fk952IDmI4nw3nPrvtQdM0ZT4WpC0= github.com/jackc/pgtype v1.3.1-0.20200510190516-8cd94a14c75a/go.mod h1:vaogEUkALtxZMCH411K+tKzNpwzCKU+AnPzBKZ+I+Po= github.com/jackc/pgtype v1.3.1-0.20200606141011-f6355165a91c/go.mod h1:cvk9Bgu/VzJ9/lxTO5R5sf80p0DiucVtN7ZxvaC4GmQ= -github.com/jackc/pgtype v1.5.0 h1:jzBqRk2HFG2CV4AIwgCI2PwTgm6UUoCAK2ofHHRirtc= github.com/jackc/pgtype v1.5.0/go.mod h1:JCULISAZBFGrHaOXIIFiyfzW5VY0GRitRr8NeJsrdig= github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= github.com/jackc/pgtype v1.8.1 h1:9k0IXtdJXHJbyAWQgbWr1lU+MEhPXZz6RIXxfR5oxXs= @@ -328,7 +318,6 @@ github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQ github.com/jackc/pgx/v4 v4.5.0/go.mod h1:EpAKPLdnTorwmPUUsqrPxy5fphV18j9q3wrfRXgo+kA= github.com/jackc/pgx/v4 v4.6.1-0.20200510190926-94ba730bb1e9/go.mod h1:t3/cdRQl6fOLDxqtlyhe9UWgfIi9R8+8v8GKV5TRA/o= github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904/go.mod h1:ZDaNWkt9sW1JMiNn0kdYBaLelIhw7Pg4qd+Vk6tw7Hg= -github.com/jackc/pgx/v4 v4.9.0 h1:6STjDqppM2ROy5p1wNDcsC7zJTjSHeuCsguZmXyzx7c= github.com/jackc/pgx/v4 v4.9.0/go.mod h1:MNGWmViCgqbZck9ujOOBN63gK9XVGILXWCvKLGKmnms= github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= github.com/jackc/pgx/v4 v4.13.0 h1:JCjhT5vmhMAf/YwBHLvrBn4OGdIQBiFG6ym8Zmdx570= @@ -343,8 +332,6 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.1 h1:g39TucaRWyV3dwDO++eEc6qf8TVIQ/Da48WmqjZ3i7E= github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= -github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA= -github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/jmoiron/sqlx v1.3.4 h1:wv+0IJZfL5z0uZoUjlpKgHkgaFSYD+r9CfrXjEXsO7w= github.com/jmoiron/sqlx v1.3.4/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ= github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg= @@ -366,8 +353,8 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= @@ -378,15 +365,15 @@ github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.1-0.20191011153232-f91d3411e481/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.7.0 h1:h93mCPfUSkaul3Ka/VG8uZdmW1uMHDGxzu0NWHuJmHY= github.com/lib/pq v1.7.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.4 h1:SO9z7FRPzA03QhHKJrH5BXA6HU1rS4V2nIVrrNC1iYk= github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/luna-duclos/instrumentedsql v1.1.3 h1:t7mvC0z1jUt5A0UQ6I/0H31ryymuQRnJcWCiqV3lSAA= github.com/luna-duclos/instrumentedsql v1.1.3/go.mod h1:9J1njvFds+zN7y85EDhN9XNQLANWwZt2ULeIC8yMNYs= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/markbates/oncer v1.0.0/go.mod h1:Z59JA581E9GP6w96jai+TGqafHPW+cPfRxz2aSZ0mcI= github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= @@ -404,8 +391,6 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA= github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.9 h1:10HX2Td0ocZpYEjhilsuo6WWtUqttj2Kb0KtD86/KYA= @@ -422,27 +407,29 @@ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eI github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olachat/gola v0.0.0-20220823103703-50fed997fe38 h1:heBbV97QRn7QbQKWayBhFCfSVgw5p5oD6KiFdn63ivo= +github.com/olachat/gola v0.0.0-20220823103703-50fed997fe38/go.mod h1:8yZiiatr9aXclGhrkXPStIujmyKiiLKxIeVCA3oCjq0= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -474,8 +461,8 @@ github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAm github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= -github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc h1:jUIKcSPO9MoMJBbEoyE/RJoE8vz7Mb8AjvifMMwSyvY= github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= @@ -492,24 +479,24 @@ github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:Udh github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e h1:qpG93cPwA5f7s/ZPBJnGOYQNK/vKsaDaseuKT5Asee8= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.2.1 h1:+KmjbUw1hriSNMF55oPrkZcb27aECyrj8V2ytv7kWDw= github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= -github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.6.3 h1:pDDu1OyEDTKzpJwdq4TiuLyMsUgRa/BT5cn5O62NoHs= github.com/spf13/viper v1.6.3/go.mod h1:jUMtyi0/lB5yZH/FjyGAoH7IMNrIhlBf6pXZmbMDvzw= +github.com/spf13/viper v1.8.1 h1:Kq1fyeebqsBfbjZj4EL7gj2IO0mMaiyjYUWcUsl2O44= github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -517,9 +504,9 @@ github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoH github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= @@ -584,12 +571,12 @@ golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -652,7 +639,6 @@ golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= @@ -729,7 +715,6 @@ golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -753,8 +738,9 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e h1:WUoyKPm6nCo1BnNUvPGnFG3T5DUVem42yDJZZ4CNxMA= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -762,12 +748,12 @@ golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fq golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -833,8 +819,8 @@ golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/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= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -941,8 +927,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= @@ -951,8 +937,8 @@ gopkg.in/gorp.v1 v1.7.2 h1:j3DWlAyGVv8whO7AcIWznQ2Yj7yJkn34B8s63GViAAw= gopkg.in/gorp.v1 v1.7.2/go.mod h1:Wo3h+DBQZIxATwftsglhdD/62zRFPhGhTiu5jUJmCaw= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= @@ -961,12 +947,12 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/postgres v1.0.2 h1:mB5JjD4QglbCTdMT1aZDxQzHr87XDK1qh0MKIU3P96g= gorm.io/driver/postgres v1.0.2/go.mod h1:FvRSYfBI9jEp6ZSjlpS9qNcSjxwYxFc03UOTrHdvvYA= diff --git a/gola/jets.go b/gola/jets.go new file mode 100644 index 0000000..8fcb6c5 --- /dev/null +++ b/gola/jets.go @@ -0,0 +1,754 @@ +// Code generated by gola 0.0.6; DO NOT EDIT. + +package jets + +import ( + "database/sql" + "encoding/json" + "reflect" + "strings" + + "github.com/olachat/gola/coredb" + + "github.com/volatiletech/null/v8" +) + +const DBName string = "mimic" +const TableName string = "jets" + +// Jet represents `jets` table +type Jet struct { + // int + Id `json:"id"` + // int + PilotId `json:"pilot_id"` + // int + AirportId `json:"airport_id"` + // varchar + Name `json:"name"` + // varchar + Color `json:"color"` + // varchar + Uuid `json:"uuid"` + // varchar + Identifier `json:"identifier"` + // varbinary + Cargo `json:"cargo"` + // varbinary + Manifest `json:"manifest"` +} + +type withPK interface { + GetId() int +} + +// FetchByPK returns a row from `jets` table with given primary key value +func FetchByPK(val int) *Jet { + return coredb.FetchByPK[Jet](DBName, TableName, []string{"id"}, val) +} + +// FetchFieldsByPK returns a row with selected fields from jets table with given primary key value +func FetchFieldsByPK[T any](val int) *T { + return coredb.FetchByPK[T](DBName, TableName, []string{"id"}, val) +} + +// FetchByPKs returns rows with from `jets` table with given primary key values +func FetchByPKs(vals ...int) []*Jet { + pks := coredb.GetAnySlice(vals) + return coredb.FetchByPKs[Jet](DBName, TableName, "id", pks) +} + +// FetchFieldsByPKs returns rows with selected fields from `jets` table with given primary key values +func FetchFieldsByPKs[T any](vals ...int) []*T { + pks := coredb.GetAnySlice(vals) + return coredb.FetchByPKs[T](DBName, TableName, "id", pks) +} + +// FindOne returns a row from `jets` table with arbitary where query +// whereSQL must start with "where ..." +func FindOne(whereSQL string, params ...any) *Jet { + w := coredb.NewWhere(whereSQL, params...) + return coredb.FindOne[Jet](DBName, TableName, w) +} + +// FindOneFields returns a row with selected fields from `jets` table with arbitary where query +// whereSQL must start with "where ..." +func FindOneFields[T any](whereSQL string, params ...any) *T { + w := coredb.NewWhere(whereSQL, params...) + return coredb.FindOne[T](DBName, TableName, w) +} + +// Find returns rows from `jets` table with arbitary where query +// whereSQL must start with "where ..." +func Find(whereSQL string, params ...any) ([]*Jet, error) { + w := coredb.NewWhere(whereSQL, params...) + return coredb.Find[Jet](DBName, TableName, w) +} + +// FindFields returns rows with selected fields from `jets` table with arbitary where query +// whereSQL must start with "where ..." +func FindFields[T any](whereSQL string, params ...any) ([]*T, error) { + w := coredb.NewWhere(whereSQL, params...) + return coredb.Find[T](DBName, TableName, w) +} + +// Count returns select count(*) with arbitary where query +// whereSQL must start with "where ..." +func Count(whereSQL string, params ...any) (int, error) { + return coredb.QueryInt(DBName, "SELECT COUNT(*) FROM `jets` "+whereSQL, params...) +} + +// Column types + +// Id field +// +type Id struct { + isAssigned bool + val int +} + +func (c *Id) GetId() int { + return c.val +} + +func (c *Id) GetColumnName() string { + return "id" +} + +func (c *Id) GetValPointer() any { + return &c.val +} + +func (c *Id) MarshalJSON() ([]byte, error) { + return json.Marshal(&c.val) +} + +func (c *Id) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &c.val); err != nil { + return err + } + + return nil +} + +// PilotId field +// +type PilotId struct { + _updated bool + val int +} + +func (c *PilotId) GetPilotId() int { + return c.val +} + +func (c *PilotId) SetPilotId(val int) bool { + if c.val == val { + return false + } + c._updated = true + c.val = val + return true +} + +func (c *PilotId) IsUpdated() bool { + return c._updated +} + +func (c *PilotId) resetUpdated() { + c._updated = false +} + +func (c *PilotId) GetColumnName() string { + return "pilot_id" +} + +func (c *PilotId) GetValPointer() any { + return &c.val +} + +func (c *PilotId) MarshalJSON() ([]byte, error) { + return json.Marshal(&c.val) +} + +func (c *PilotId) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &c.val); err != nil { + return err + } + + return nil +} + +// AirportId field +// +type AirportId struct { + _updated bool + val int +} + +func (c *AirportId) GetAirportId() int { + return c.val +} + +func (c *AirportId) SetAirportId(val int) bool { + if c.val == val { + return false + } + c._updated = true + c.val = val + return true +} + +func (c *AirportId) IsUpdated() bool { + return c._updated +} + +func (c *AirportId) resetUpdated() { + c._updated = false +} + +func (c *AirportId) GetColumnName() string { + return "airport_id" +} + +func (c *AirportId) GetValPointer() any { + return &c.val +} + +func (c *AirportId) MarshalJSON() ([]byte, error) { + return json.Marshal(&c.val) +} + +func (c *AirportId) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &c.val); err != nil { + return err + } + + return nil +} + +// Name field +// +type Name struct { + _updated bool + val string +} + +func (c *Name) GetName() string { + return c.val +} + +func (c *Name) SetName(val string) bool { + if c.val == val { + return false + } + c._updated = true + c.val = val + return true +} + +func (c *Name) IsUpdated() bool { + return c._updated +} + +func (c *Name) resetUpdated() { + c._updated = false +} + +func (c *Name) GetColumnName() string { + return "name" +} + +func (c *Name) GetValPointer() any { + return &c.val +} + +func (c *Name) MarshalJSON() ([]byte, error) { + return json.Marshal(&c.val) +} + +func (c *Name) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &c.val); err != nil { + return err + } + + return nil +} + +// Color field +// +type Color struct { + _updated bool + val null.String +} + +func (c *Color) GetColor() null.String { + return c.val +} + +func (c *Color) SetColor(val null.String) bool { + if c.val == val { + return false + } + c._updated = true + c.val = val + return true +} + +func (c *Color) IsUpdated() bool { + return c._updated +} + +func (c *Color) resetUpdated() { + c._updated = false +} + +func (c *Color) GetColumnName() string { + return "color" +} + +func (c *Color) GetValPointer() any { + return &c.val +} + +func (c *Color) MarshalJSON() ([]byte, error) { + return json.Marshal(&c.val) +} + +func (c *Color) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &c.val); err != nil { + return err + } + + return nil +} + +// Uuid field +// +type Uuid struct { + _updated bool + val string +} + +func (c *Uuid) GetUuid() string { + return c.val +} + +func (c *Uuid) SetUuid(val string) bool { + if c.val == val { + return false + } + c._updated = true + c.val = val + return true +} + +func (c *Uuid) IsUpdated() bool { + return c._updated +} + +func (c *Uuid) resetUpdated() { + c._updated = false +} + +func (c *Uuid) GetColumnName() string { + return "uuid" +} + +func (c *Uuid) GetValPointer() any { + return &c.val +} + +func (c *Uuid) MarshalJSON() ([]byte, error) { + return json.Marshal(&c.val) +} + +func (c *Uuid) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &c.val); err != nil { + return err + } + + return nil +} + +// Identifier field +// +type Identifier struct { + _updated bool + val string +} + +func (c *Identifier) GetIdentifier() string { + return c.val +} + +func (c *Identifier) SetIdentifier(val string) bool { + if c.val == val { + return false + } + c._updated = true + c.val = val + return true +} + +func (c *Identifier) IsUpdated() bool { + return c._updated +} + +func (c *Identifier) resetUpdated() { + c._updated = false +} + +func (c *Identifier) GetColumnName() string { + return "identifier" +} + +func (c *Identifier) GetValPointer() any { + return &c.val +} + +func (c *Identifier) MarshalJSON() ([]byte, error) { + return json.Marshal(&c.val) +} + +func (c *Identifier) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &c.val); err != nil { + return err + } + + return nil +} + +// Cargo field +// +type Cargo struct { + _updated bool + val []byte +} + +func (c *Cargo) GetCargo() []byte { + return c.val +} + +func (c *Cargo) SetCargo(val []byte) bool { + c._updated = true + c.val = val + return true +} + +func (c *Cargo) IsUpdated() bool { + return c._updated +} + +func (c *Cargo) resetUpdated() { + c._updated = false +} + +func (c *Cargo) GetColumnName() string { + return "cargo" +} + +func (c *Cargo) GetValPointer() any { + return &c.val +} + +func (c *Cargo) MarshalJSON() ([]byte, error) { + return json.Marshal(&c.val) +} + +func (c *Cargo) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &c.val); err != nil { + return err + } + + return nil +} + +// Manifest field +// +type Manifest struct { + _updated bool + val []byte +} + +func (c *Manifest) GetManifest() []byte { + return c.val +} + +func (c *Manifest) SetManifest(val []byte) bool { + c._updated = true + c.val = val + return true +} + +func (c *Manifest) IsUpdated() bool { + return c._updated +} + +func (c *Manifest) resetUpdated() { + c._updated = false +} + +func (c *Manifest) GetColumnName() string { + return "manifest" +} + +func (c *Manifest) GetValPointer() any { + return &c.val +} + +func (c *Manifest) MarshalJSON() ([]byte, error) { + return json.Marshal(&c.val) +} + +func (c *Manifest) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &c.val); err != nil { + return err + } + + return nil +} + +// New return new *Jet with default values +func New() *Jet { + return &Jet{ + Id{}, + PilotId{}, + AirportId{}, + Name{}, + Color{}, + Uuid{}, + Identifier{}, + Cargo{}, + Manifest{}, + } +} + +// NewWithPK takes "id" +// and returns new *Jet with given PK +func NewWithPK(val int) *Jet { + c := &Jet{ + Id{}, + PilotId{}, + AirportId{}, + Name{}, + Color{}, + Uuid{}, + Identifier{}, + Cargo{}, + Manifest{}, + } + c.Id.val = val + c.Id.isAssigned = true + return c +} + +const insertWithoutPK string = "INSERT IGNORE INTO `jets` (`pilot_id`, `airport_id`, `name`, `color`, `uuid`, `identifier`, `cargo`, `manifest`) values (?, ?, ?, ?, ?, ?, ?, ?)" +const insertWithPK string = "INSERT IGNORE INTO `jets` (`id`, `pilot_id`, `airport_id`, `name`, `color`, `uuid`, `identifier`, `cargo`, `manifest`) values (?, ?, ?, ?, ?, ?, ?, ?, ?)" + +// Insert Jet struct to `jets` table +func (c *Jet) Insert() error { + var result sql.Result + var err error + if c.Id.isAssigned { + result, err = coredb.Exec(DBName, insertWithPK, c.GetId(), c.GetPilotId(), c.GetAirportId(), c.GetName(), c.GetColor(), c.GetUuid(), c.GetIdentifier(), c.GetCargo(), c.GetManifest()) + if err != nil { + return err + } + } else { + result, err = coredb.Exec(DBName, insertWithoutPK, c.GetPilotId(), c.GetAirportId(), c.GetName(), c.GetColor(), c.GetUuid(), c.GetIdentifier(), c.GetCargo(), c.GetManifest()) + if err != nil { + return err + } + + id, err := result.LastInsertId() + if err != nil { + return err + } + c.Id.val = int(id) + } + + affectedRows, err := result.RowsAffected() + if err != nil { + return err + } + if affectedRows == 0 { + return coredb.ErrAvoidInsert + } + + c.resetUpdated() + return nil +} + +func (c *Jet) resetUpdated() { + c.PilotId.resetUpdated() + c.AirportId.resetUpdated() + c.Name.resetUpdated() + c.Color.resetUpdated() + c.Uuid.resetUpdated() + c.Identifier.resetUpdated() + c.Cargo.resetUpdated() + c.Manifest.resetUpdated() +} + +// Update Jet struct in `jets` table +func (obj *Jet) Update() (bool, error) { + var updatedFields []string + var params []any + if obj.PilotId.IsUpdated() { + updatedFields = append(updatedFields, "`pilot_id` = ?") + params = append(params, obj.GetPilotId()) + } + if obj.AirportId.IsUpdated() { + updatedFields = append(updatedFields, "`airport_id` = ?") + params = append(params, obj.GetAirportId()) + } + if obj.Name.IsUpdated() { + updatedFields = append(updatedFields, "`name` = ?") + params = append(params, obj.GetName()) + } + if obj.Color.IsUpdated() { + updatedFields = append(updatedFields, "`color` = ?") + params = append(params, obj.GetColor()) + } + if obj.Uuid.IsUpdated() { + updatedFields = append(updatedFields, "`uuid` = ?") + params = append(params, obj.GetUuid()) + } + if obj.Identifier.IsUpdated() { + updatedFields = append(updatedFields, "`identifier` = ?") + params = append(params, obj.GetIdentifier()) + } + if obj.Cargo.IsUpdated() { + updatedFields = append(updatedFields, "`cargo` = ?") + params = append(params, obj.GetCargo()) + } + if obj.Manifest.IsUpdated() { + updatedFields = append(updatedFields, "`manifest` = ?") + params = append(params, obj.GetManifest()) + } + + if len(updatedFields) == 0 { + return false, nil + } + + sql := "UPDATE `jets` SET " + sql = sql + strings.Join(updatedFields, ",") + " WHERE `id` = ?" + params = append(params, obj.GetId()) + + result, err := coredb.Exec(DBName, sql, params...) + if err != nil { + return false, err + } + + affectedRows, err := result.RowsAffected() + if err != nil { + return false, err + } + if affectedRows == 0 { + return false, coredb.ErrAvoidUpdate + } + + obj.resetUpdated() + return true, nil +} + +// Update Jet struct with given fields in `jets` table +func Update(obj withPK) (bool, error) { + var updatedFields []string + var params []any + var resetFuncs []func() + + val := reflect.ValueOf(obj).Elem() + updatedFields = make([]string, 0, val.NumField()) + params = make([]any, 0, val.NumField()) + + for i := 0; i < val.NumField(); i++ { + col := val.Field(i).Addr().Interface() + + switch c := col.(type) { + case *PilotId: + if c.IsUpdated() { + updatedFields = append(updatedFields, "`pilot_id` = ?") + params = append(params, c.GetPilotId()) + resetFuncs = append(resetFuncs, c.resetUpdated) + } + case *AirportId: + if c.IsUpdated() { + updatedFields = append(updatedFields, "`airport_id` = ?") + params = append(params, c.GetAirportId()) + resetFuncs = append(resetFuncs, c.resetUpdated) + } + case *Name: + if c.IsUpdated() { + updatedFields = append(updatedFields, "`name` = ?") + params = append(params, c.GetName()) + resetFuncs = append(resetFuncs, c.resetUpdated) + } + case *Color: + if c.IsUpdated() { + updatedFields = append(updatedFields, "`color` = ?") + params = append(params, c.GetColor()) + resetFuncs = append(resetFuncs, c.resetUpdated) + } + case *Uuid: + if c.IsUpdated() { + updatedFields = append(updatedFields, "`uuid` = ?") + params = append(params, c.GetUuid()) + resetFuncs = append(resetFuncs, c.resetUpdated) + } + case *Identifier: + if c.IsUpdated() { + updatedFields = append(updatedFields, "`identifier` = ?") + params = append(params, c.GetIdentifier()) + resetFuncs = append(resetFuncs, c.resetUpdated) + } + case *Cargo: + if c.IsUpdated() { + updatedFields = append(updatedFields, "`cargo` = ?") + params = append(params, c.GetCargo()) + resetFuncs = append(resetFuncs, c.resetUpdated) + } + case *Manifest: + if c.IsUpdated() { + updatedFields = append(updatedFields, "`manifest` = ?") + params = append(params, c.GetManifest()) + resetFuncs = append(resetFuncs, c.resetUpdated) + } + } + } + + if len(updatedFields) == 0 { + return false, nil + } + + sql := "UPDATE `jets` SET " + sql = sql + strings.Join(updatedFields, ",") + " WHERE `id` = ?" + params = append(params, obj.GetId()) + + result, err := coredb.Exec(DBName, sql, params...) + if err != nil { + return false, err + } + + affectedRows, err := result.RowsAffected() + if err != nil { + return false, err + } + if affectedRows == 0 { + return false, coredb.ErrAvoidUpdate + } + + for _, f := range resetFuncs { + f() + } + return true, nil +} + +const deleteSql string = "DELETE FROM `jets` WHERE `id` = ?" + +// DeleteByPK delete a row from jets table with given primary key value +func DeleteByPK(val int) error { + _, err := coredb.Exec(DBName, deleteSql, val) + return err +} diff --git a/gola/jets_idx.go b/gola/jets_idx.go new file mode 100644 index 0000000..950a9db --- /dev/null +++ b/gola/jets_idx.go @@ -0,0 +1,130 @@ +// Code generated by gola 0.0.6; DO NOT EDIT. + +package jets + +import ( + "fmt" + "strings" + + "github.com/olachat/gola/coredb" +) + +type orderBy int + +type idxQuery[T any] struct { + whereSql string + limitSql string + orders []string + whereParams []any +} + +// order by enum & interface +const ( + IdAsc orderBy = iota + IdDesc + PilotIdAsc + PilotIdDesc + AirportIdAsc + AirportIdDesc + NameAsc + NameDesc + ColorAsc + ColorDesc + UuidAsc + UuidDesc + IdentifierAsc + IdentifierDesc + CargoAsc + CargoDesc + ManifestAsc + ManifestDesc +) + +func (q *idxQuery[T]) OrderBy(args ...orderBy) coredb.ReadQuery[T] { + q.orders = make([]string, len(args)) + for i, arg := range args { + switch arg { + case IdAsc: + q.orders[i] = "`id` asc" + case IdDesc: + q.orders[i] = "`id` desc" + case PilotIdAsc: + q.orders[i] = "`pilot_id` asc" + case PilotIdDesc: + q.orders[i] = "`pilot_id` desc" + case AirportIdAsc: + q.orders[i] = "`airport_id` asc" + case AirportIdDesc: + q.orders[i] = "`airport_id` desc" + case NameAsc: + q.orders[i] = "`name` asc" + case NameDesc: + q.orders[i] = "`name` desc" + case ColorAsc: + q.orders[i] = "`color` asc" + case ColorDesc: + q.orders[i] = "`color` desc" + case UuidAsc: + q.orders[i] = "`uuid` asc" + case UuidDesc: + q.orders[i] = "`uuid` desc" + case IdentifierAsc: + q.orders[i] = "`identifier` asc" + case IdentifierDesc: + q.orders[i] = "`identifier` desc" + case CargoAsc: + q.orders[i] = "`cargo` asc" + case CargoDesc: + q.orders[i] = "`cargo` desc" + case ManifestAsc: + q.orders[i] = "`manifest` asc" + case ManifestDesc: + q.orders[i] = "`manifest` desc" + } + } + return q +} + +func (q *idxQuery[T]) All() []*T { + result, _ := coredb.Find[T](DBName, TableName, q) + return result +} + +func (q *idxQuery[T]) Limit(offset, limit int) []*T { + q.limitSql = fmt.Sprintf(" limit %d, %d", offset, limit) + result, _ := coredb.Find[T](DBName, TableName, q) + return result +} + +type order[T any] interface { + OrderBy(args ...orderBy) coredb.ReadQuery[T] +} + +type orderReadQuery[T any] interface { + order[T] + coredb.ReadQuery[T] +} + +type iQuery[T any] interface { + orderReadQuery[T] +} + +// Find methods + +// Select returns rows from `jets` table with index awared query +func Select() iQuery[Jet] { + return new(idxQuery[Jet]) +} + +// SelectFields returns rows with selected fields from `jets` table with index awared query +func SelectFields[T any]() iQuery[T] { + return new(idxQuery[T]) +} + +func (q *idxQuery[T]) GetWhere() (whereSql string, params []any) { + var orderSql string + if len(q.orders) > 0 { + orderSql = " order by " + strings.Join(q.orders, ",") + } + return q.whereSql + orderSql + q.limitSql, q.whereParams +} diff --git a/insert_test.go b/insert_test.go index ca4544f..b9ceea2 100644 --- a/insert_test.go +++ b/insert_test.go @@ -3,9 +3,12 @@ package main import ( "context" "database/sql" - "github.com/gobuffalo/pop/v6" "testing" + "github.com/gobuffalo/pop/v6" + "github.com/olachat/gola/coredb" + + golas "github.com/volatiletech/boilbench/gola" "github.com/volatiletech/boilbench/gorms" "github.com/volatiletech/boilbench/gorps" "github.com/volatiletech/boilbench/mimic" @@ -41,6 +44,34 @@ func BenchmarkGORMInsert(b *testing.B) { }) } +func BenchmarkGOLAInsert(b *testing.B) { + exec := jetQueryInsert() + exec.NumInput = -1 + exec.Result = &mimic.Result{ + NumRows: 1, + } + mimic.NewResult(exec) + + db, err := sql.Open("mimic", "") + if err != nil { + panic(err) + } + + coredb.Setup(func(_ string, _ coredb.DBMode) *sql.DB { + return db + }) + + b.Run("gola", func(b *testing.B) { + for i := 0; i < b.N; i++ { + store := golas.NewWithPK(1) + err := store.Insert() + if err != nil { + b.Fatal(err) + } + } + }) +} + func BenchmarkGORPInsert(b *testing.B) { store := gorps.Jet{ ID: 1, diff --git a/main_test.go b/main_test.go index 9f61204..830c391 100644 --- a/main_test.go +++ b/main_test.go @@ -35,6 +35,31 @@ func jetQuery() mimic.QueryResult { } } +func jetQuerySubset() mimic.QueryResult { + return mimic.QueryResult{ + Query: &mimic.Query{ + Cols: []string{"id", "name", "color", "uuid", "identifier", "cargo", "manifest"}, + Vals: [][]driver.Value{ + { + int64(1), "test", nil, "test", "test", []byte("test"), []byte("test"), + }, + { + int64(2), "test", nil, "test", "test", []byte("test"), []byte("test"), + }, + { + int64(3), "test", nil, "test", "test", []byte("test"), []byte("test"), + }, + { + int64(4), "test", nil, "test", "test", []byte("test"), []byte("test"), + }, + { + int64(5), "test", nil, "test", "test", []byte("test"), []byte("test"), + }, + }, + }, + } +} + func pilotQuery() mimic.QueryResult { return mimic.QueryResult{ Query: &mimic.Query{ diff --git a/raw_bind_test.go b/raw_bind_test.go index 2475577..2a0fa53 100644 --- a/raw_bind_test.go +++ b/raw_bind_test.go @@ -3,10 +3,13 @@ package main import ( "context" "database/sql" - "github.com/gobuffalo/pop/v6" "testing" + "github.com/gobuffalo/pop/v6" + "github.com/olachat/gola/coredb" + "github.com/jmoiron/sqlx" + golas "github.com/volatiletech/boilbench/gola" "github.com/volatiletech/boilbench/gorms" "github.com/volatiletech/boilbench/gorps" "github.com/volatiletech/boilbench/mimic" @@ -39,6 +42,30 @@ func BenchmarkGORMRawBind(b *testing.B) { }) } +func BenchmarkGOLARawBind(b *testing.B) { + query := jetQuery() + mimic.NewQuery(query) + + db, err := sql.Open("mimic", "") + if err != nil { + panic(err) + } + + coredb.Setup(func(_ string, _ coredb.DBMode) *sql.DB { + return db + }) + + b.Run("gola", func(b *testing.B) { + for i := 0; i < b.N; i++ { + store, err := coredb.Query[golas.Jet]("minic", "select * from jets") + if store == nil { + b.Fatal(err) + } + store = nil + } + }) +} + func BenchmarkGORPRawBind(b *testing.B) { query := jetQuery() mimic.NewQuery(query) diff --git a/select_test.go b/select_test.go index 2fc9b51..87ed09c 100644 --- a/select_test.go +++ b/select_test.go @@ -3,9 +3,12 @@ package main import ( "context" "database/sql" - "github.com/gobuffalo/pop/v6" "testing" + "github.com/gobuffalo/pop/v6" + "github.com/olachat/gola/coredb" + + golas "github.com/volatiletech/boilbench/gola" "github.com/volatiletech/boilbench/gorms" "github.com/volatiletech/boilbench/gorps" "github.com/volatiletech/boilbench/mimic" @@ -38,6 +41,30 @@ func BenchmarkGORMSelectAll(b *testing.B) { }) } +func BenchmarkGOLASelectAll(b *testing.B) { + query := jetQuery() + mimic.NewQuery(query) + + db, err := sql.Open("mimic", "") + if err != nil { + panic(err) + } + + coredb.Setup(func(_ string, _ coredb.DBMode) *sql.DB { + return db + }) + + b.Run("gola", func(b *testing.B) { + for i := 0; i < b.N; i++ { + store := golas.Select().All() + if len(store) != 5 { + b.Fatal("gola load failed: ") + } + store = nil + } + }) +} + func BenchmarkGORPSelectAll(b *testing.B) { query := jetQuery() mimic.NewQuery(query) @@ -134,7 +161,7 @@ func BenchmarkPopSelectAll(b *testing.B) { func BenchmarkGORMSelectSubset(b *testing.B) { var store []gorms.Jet - query := jetQuery() + query := jetQuerySubset() mimic.NewQuery(query) gormdb, err := gorm.Open(gormMimicDialector, &gorm.Config{}) @@ -153,8 +180,40 @@ func BenchmarkGORMSelectSubset(b *testing.B) { }) } +func BenchmarkGOLASelectSubset(b *testing.B) { + query := jetQuerySubset() + mimic.NewQuery(query) + + db, err := sql.Open("mimic", "") + if err != nil { + panic(err) + } + + coredb.Setup(func(_ string, _ coredb.DBMode) *sql.DB { + return db + }) + + b.Run("gola", func(b *testing.B) { + for i := 0; i < b.N; i++ { + store := golas.SelectFields[struct { + golas.Id + golas.Name + golas.Color + golas.Uuid + golas.Identifier + golas.Cargo + golas.Manifest + }]().All() + if len(store) != 5 { + b.Fatal("gola load failed: ") + } + store = nil + } + }) +} + func BenchmarkGORPSelectSubset(b *testing.B) { - query := jetQuery() + query := jetQuerySubset() mimic.NewQuery(query) db, err := sql.Open("mimic", "") @@ -180,7 +239,7 @@ func BenchmarkGORPSelectSubset(b *testing.B) { } func BenchmarkXORMSelectSubset(b *testing.B) { - query := jetQuery() + query := jetQuerySubset() mimic.NewQuery(query) xormdb, err := xorm.NewEngine("mimic", "") @@ -201,7 +260,7 @@ func BenchmarkXORMSelectSubset(b *testing.B) { } func BenchmarkBoilSelectSubset(b *testing.B) { - query := jetQuery() + query := jetQuerySubset() mimic.NewQuery(query) db, err := sql.Open("mimic", "") @@ -223,7 +282,7 @@ func BenchmarkBoilSelectSubset(b *testing.B) { func BenchmarkPopSelectSubset(b *testing.B) { dsn := "postgres://BenchmarkPopSelectSubset" - query := jetQuery() + query := jetQuerySubset() mimic.NewQueryDSN(dsn, query) popdb, err := pop.NewConnection(&pop.ConnectionDetails{Driver: "mimic", Dialect: "postgres", URL: dsn}) @@ -275,6 +334,41 @@ func BenchmarkGORMSelectComplex(b *testing.B) { }) } +func BenchmarkGOLASelectComplex(b *testing.B) { + query := jetQuerySubset() + query.NumInput = -1 + mimic.NewQuery(query) + + db, err := sql.Open("mimic", "") + if err != nil { + panic(err) + } + + coredb.Setup(func(_ string, _ coredb.DBMode) *sql.DB { + return db + }) + + type miniJet struct { + golas.Id + golas.Name + golas.Color + golas.Uuid + golas.Identifier + golas.Cargo + golas.Manifest + } + + b.Run("gola", func(b *testing.B) { + for i := 0; i < b.N; i++ { + store, err := golas.FindFields[miniJet]("where id > 1 and name <> ? group by id limit ?, ?", 1, "thing", 1, 1) + if store == nil { + b.Fatal(err) + } + store = nil + } + }) +} + func BenchmarkGORPSelectComplex(b *testing.B) { query := jetQuery() query.NumInput = -1 diff --git a/update_test.go b/update_test.go index d4ac570..5ddf915 100644 --- a/update_test.go +++ b/update_test.go @@ -3,9 +3,12 @@ package main import ( "context" "database/sql" + "testing" + "github.com/gobuffalo/pop/v6" + "github.com/olachat/gola/coredb" + golas "github.com/volatiletech/boilbench/gola" "github.com/volatiletech/boilbench/pops" - "testing" "github.com/volatiletech/boilbench/gorms" "github.com/volatiletech/boilbench/gorps" @@ -42,6 +45,32 @@ func BenchmarkGORMUpdate(b *testing.B) { }) } +func BenchmarkGOLAUpdate(b *testing.B) { + exec := jetExecUpdate() + exec.NumInput = -1 + mimic.NewResult(exec) + + db, err := sql.Open("mimic", "") + if err != nil { + panic(err) + } + + coredb.Setup(func(_ string, _ coredb.DBMode) *sql.DB { + return db + }) + + b.Run("gola", func(b *testing.B) { + for i := 0; i < b.N; i++ { + store := golas.NewWithPK(1) + store.SetName("name") + _, err := store.Update() + if err != nil { + b.Fatal(err) + } + } + }) +} + func BenchmarkGORPUpdate(b *testing.B) { store := gorps.Jet{ ID: 1,