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

Remove Response type from public API #8

Merged
merged 4 commits into from
Jan 16, 2022

Conversation

FZambia
Copy link
Owner

@FZambia FZambia commented Jan 8, 2022

Related #7

Removing Response type from public API. This should make error handling more straightforward. I.e. eliminate code like this:

resp, err = conn.Exec(...)
if err != nil {
    // Handle error
}
if resp.Error != "" {
  // Handle Response.Error
}
// Handle Response.Data

While it was not really necessary having Error in Response struct seems frustrating.

The code above becomes:

result, err = conn.Exec(...)
if err != nil {
    // Handle error
}
// Handle result which is []interface{} – i.e. what was previously in Response.Data

Changes:

gorelease -base v0.2.3 -version v0.3.0
# github.com/FZambia/tarantool
## incompatible changes
(*Connection).Exec: changed from func(*Request) (*Response, error) to func(*Request) ([]interface{}, error)
(*Connection).ExecContext: changed from func(context.Context, *Request) (*Response, error) to func(context.Context, *Request) ([]interface{}, error)
(*Request).WithPush: changed from func(func(*Response)) *Request to func(func([]interface{})) *Request
ErrorCodeBit: removed
Future.Get: changed from func() (*Response, error) to func() ([]interface{}, error)
FutureContext.GetContext: changed from func(context.Context) (*Response, error) to func(context.Context) ([]interface{}, error)
OkCode: removed
Response: removed

# summary
v0.3.0 is a valid semantic version for this release.

@FZambia FZambia changed the title Remove Response type from public Remove Response type from public API Jan 8, 2022
@FZambia FZambia marked this pull request as ready for review January 8, 2022 16:05
@FZambia FZambia merged commit 7aeb1a1 into master Jan 16, 2022
@FZambia FZambia deleted the remove_response_type_from_public branch January 16, 2022 07:08
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.

1 participant