Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for general binding and parsing any types #265

Closed
wants to merge 1 commit into from
Closed

Conversation

Kulezi
Copy link
Contributor

@Kulezi Kulezi commented Jul 26, 2022

  • Added support for binding any type with use of gocql.Marshal
  • Added support for scanning any type with use of gocql.Unmarshal
  • Binding to unprepared queries can now be done only with type-specialized methods
  • Incorrect binding will now return an error on query execution
  • Added benchmarks comparing conversions using general and concrete methods, results:
goos: linux
goarch: amd64
pkg: github.com/mmatczuk/scylla-go-driver
cpu: 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
BenchmarkBindConcrete-16        241682629                5.023 ns/op           0 B/op          0 allocs/op
BenchmarkBindAny-16             29523056                39.13 ns/op           15 B/op          1 allocs/op
BenchmarkAsConcrete-16          511050747                2.350 ns/op           0 B/op          0 allocs/op
BenchmarkAsAny-16               52738100                21.69 ns/op            8 B/op          1 allocs/op
PASS
ok      github.com/mmatczuk/scylla-go-driver    5.528s

I think this will be needed to make a compatibility layer for gocql and gocqlX, benchmarks show that it's much slower than concrete bindings, however I can barely see any difference with make run-benchtab, maybe because of the driver having spare time due to waiting on syscalls.

- Added support for binding any type with use of gocql.Marshal
- Added support for scanning any type with use of gocql.Unmarshal
- Binding to unprepared queries can now be done only with type-specialized methods
- Incorrect binding will now return an error on query execution
- Added a benchmark comparing conversions using general and concrete methods, results:
	goos: linux
	goarch: amd64
	pkg: github.com/mmatczuk/scylla-go-driver
	cpu: 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
	BenchmarkBindConcrete-16        241682629                5.023 ns/op           0 B/op          0 allocs/op
	BenchmarkBindAny-16             29523056                39.13 ns/op           15 B/op          1 allocs/op
	BenchmarkAsConcrete-16          511050747                2.350 ns/op           0 B/op          0 allocs/op
	BenchmarkAsAny-16               52738100                21.69 ns/op            8 B/op          1 allocs/op
	PASS
	ok      github.com/mmatczuk/scylla-go-driver    5.528s

Fixes #121
Fixes #123
Fixes #158
@Kulezi Kulezi changed the title [WIP] query: added remaining primitive bindings and bind errors Support for general binding and parsing any types Jul 28, 2022
@Kulezi Kulezi marked this pull request as ready for review July 28, 2022 15:06
@Kulezi
Copy link
Contributor Author

Kulezi commented Aug 8, 2022

This will be used in a separate package providing gocql compatibility.

@Kulezi Kulezi closed this Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant