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

hasql version 2.0 (work in progress) #15

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

hasql version 2.0 (work in progress) #15

wants to merge 11 commits into from

Conversation

bbrodriges
Copy link
Contributor

This is an attempt to rethink multiple parts of hasql without changing its core mechanics. It is a breaking changes upgrade (hence v2), although it requires to perform minor code changes for existing end users to adopt this version.

This is a Work In Progress pull request as there are not much test for now. Also I want to collect as many feedback as possible to be able to implement all necessary changes before merge.

Notable changes

  • Minimal Go version bumped to 1.22 due to usage of generics, errors.Join and slices package
  • *Node is now a generic *Node[T] allowing to use any sql.DB compatible driver directly
  • NodeDiscoverer interface allows to provide dynamic nodes list (e.g. service discovery) oppose to static []*Node slice
  • NodeChecker is now able to provide any additional information about cluster node (such as latency, replication lag etc.) and this information can be used to pick appropriate node

Minor changes

  • Cluster now uses internal context.WithCancel for more robust Close method execution
  • Code base simplification

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 53.87755% with 113 lines in your changes missing coverage. Please review.

Project coverage is 52.23%. Comparing base (f03fa5f) to head (de33ece).

Files with missing lines Patch % Lines
node_checker.go 21.73% 54 Missing ⚠️
checked_node.go 62.96% 20 Missing ⚠️
notify.go 25.00% 12 Missing ⚠️
trace.go 0.00% 6 Missing and 4 partials ⚠️
error.go 30.76% 9 Missing ⚠️
cluster.go 91.83% 4 Missing ⚠️
cluster_opts.go 0.00% 4 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (f03fa5f) and HEAD (de33ece). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (f03fa5f) HEAD (de33ece)
unittests 2 1
Additional details and impacted files
@@             Coverage Diff             @@
##           master      #15       +/-   ##
===========================================
- Coverage   87.14%   52.23%   -34.91%     
===========================================
  Files           8       10        +2     
  Lines         249      268       +19     
===========================================
- Hits          217      140       -77     
- Misses         27      124       +97     
+ Partials        5        4        -1     
Flag Coverage Δ
unittests 52.23% <53.87%> (-34.91%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bbrodriges Can you please add some examples? It would greatly help with this PR's assessment.

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.

3 participants