You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This interface abstracts away our dependency on the database/sql library and allows we ourselves and our users to implement alternative implementations if necessary.
This allowed us to add the function NewWithPGX() which instantiates the ksql.Client but using the PGx as the backend database adapter.
This configuration allows the users to use all the query param types by PGX and it also showed great results in the benchmark which is also good.
$ make bench TIME=5s
go test -bench=. -benchtime=5s
goos: linux
goarch: amd64
pkg: github.com/vingarcia/ksql
cpu: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
BenchmarkInsert/ksql-setup/insert-one-4 5293 960859 ns/op
BenchmarkInsert/pgx-adapter-setup/insert-one-4 7982 736973 ns/op
BenchmarkInsert/sqlx-setup/insert-one-4 6854 857824 ns/op
BenchmarkQuery/ksql-setup/single-row-4 12596 407116 ns/op
BenchmarkQuery/ksql-setup/multiple-rows-4 15883 391135 ns/op
BenchmarkQuery/pgx-adapter-setup/single-row-4 34008 165604 ns/op
BenchmarkQuery/pgx-adapter-setup/multiple-rows-4 22579 280673 ns/op
BenchmarkQuery/sqlx-setup/single-row-4 10000 512741 ns/op
BenchmarkQuery/sqlx-setup/multiple-rows-4 10779 596377 ns/op
PASS
ok github.com/vingarcia/ksql 94.951s
Benchmark executed at: 2021-08-01
Benchmark executed on commit: 37298e2c243f1ec66e88dd92ed7c4542f7820b4f
Other changes
Rename structs/ subpackage to kstructs in order to avoid name collisions with packages with similar names.
Rename ksql.SQLProvider interface to ksql.Provider in order to avoid stuttering
Rename ksql.MockSQLProvider struct to ksql.Mock in order to avoid stuttering
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Adds and exposes the DBAdapter interface.
This interface abstracts away our dependency on the
database/sql
library and allows we ourselves and our users to implement alternative implementations if necessary.This allowed us to add the function
NewWithPGX()
which instantiates theksql.Client
but using the PGx as the backend database adapter.This configuration allows the users to use all the query param types by PGX and it also showed great results in the benchmark which is also good.
$ make bench TIME=5s go test -bench=. -benchtime=5s goos: linux goarch: amd64 pkg: github.com/vingarcia/ksql cpu: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz BenchmarkInsert/ksql-setup/insert-one-4 5293 960859 ns/op BenchmarkInsert/pgx-adapter-setup/insert-one-4 7982 736973 ns/op BenchmarkInsert/sqlx-setup/insert-one-4 6854 857824 ns/op BenchmarkQuery/ksql-setup/single-row-4 12596 407116 ns/op BenchmarkQuery/ksql-setup/multiple-rows-4 15883 391135 ns/op BenchmarkQuery/pgx-adapter-setup/single-row-4 34008 165604 ns/op BenchmarkQuery/pgx-adapter-setup/multiple-rows-4 22579 280673 ns/op BenchmarkQuery/sqlx-setup/single-row-4 10000 512741 ns/op BenchmarkQuery/sqlx-setup/multiple-rows-4 10779 596377 ns/op PASS ok github.com/vingarcia/ksql 94.951s Benchmark executed at: 2021-08-01 Benchmark executed on commit: 37298e2c243f1ec66e88dd92ed7c4542f7820b4f
Other changes
structs/
subpackage tokstructs
in order to avoid name collisions with packages with similar names.ksql.SQLProvider
interface toksql.Provider
in order to avoid stutteringksql.MockSQLProvider
struct toksql.Mock
in order to avoid stutteringThis discussion was created from the release Expose underlying DBAdapter interface for custom implementations.
Beta Was this translation helpful? Give feedback.
All reactions