typesense / typesense-go

Go client for Typesense: https://github.com/typesense/typesense
Apache License 2.0
208 stars 55 forks source link

Take context.Context in all functions #153

Closed vegarsti closed 8 months ago

vegarsti commented 9 months ago

Thanks so much for creating Typesense and hosting the Go SDK! I would really like to pass my application's context when doing my batch imports so that I can properly cancel it and propagate timeouts. I made all such changes that I could see. Let me know if there are any missing.

Change Summary

All functions that were calling the OpenAPI generated code with a context.Background() have been changed to take a context argument.

This is obviously a breaking change in terms of function signatures, so let me know if you'd rather we do something else. We could e.g. add a DeleteContext function, a RetrieveContext function etc.

PR Checklist

Closes #143.

Cidan commented 8 months ago

@kishorenc This should be merged ASAP, as it brings this Client inline with Go standards. As of now, this Client is not usable in production without this change.

@vegarsti Thank you for this!

kishorenc commented 8 months ago

Thank you for these changes @vegarsti -- really appreciate it.

There are a few compile errors though when I attempt to run the integration tests:

TYPESENSE_URL=http://127.0.0.1:8108 TYPESENSE_API_KEY=abcd go test ./... -tags integration -v  
vegarsti commented 8 months ago

Thank you for these changes @vegarsti -- really appreciate it.

There are a few compile errors though when I attempt to run the integration tests:

TYPESENSE_URL=http://127.0.0.1:8108 TYPESENSE_API_KEY=abcd go test ./... -tags integration -v  

Oops! Thanks! The integration tests pass now!

vegarsti commented 8 months ago

Thanks so much @kishorenc! Will you cut a release with this soon-ish? 😀

kishorenc commented 8 months ago

Just did a release: https://github.com/typesense/typesense-go/releases/tag/v1.0

vegarsti commented 8 months ago

Sweet, thanks!

On Fri, 22 Dec 2023 at 14:36, Kishore Nallan @.***> wrote:

Just did a release: https://github.com/typesense/typesense-go/releases/tag/v1.0

— Reply to this email directly, view it on GitHub https://github.com/typesense/typesense-go/pull/153#issuecomment-1867698083, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLPSNKQGLI7BXVSO5K4MN3YKWEHXAVCNFSM6AAAAABAZHD6O2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRXGY4TQMBYGM . You are receiving this because you were mentioned.Message ID: @.***>

vegarsti commented 8 months ago

@kishorenc Will you please tag it as v1.0.0? It requires all three major.minor.patch to be present. Currently it will either fail or try to get the v0.1.0 version:

go get github.com/typesense/typesense-go@v0.1
go: downloading github.com/typesense/typesense-go v0.1.0
kishorenc commented 8 months ago

I have done that.

vegarsti commented 8 months ago

I have done that.

Thanks!