-
Notifications
You must be signed in to change notification settings - Fork 56
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
Start on generics #156
Start on generics #156
Conversation
hey @kishorenc this is just a start but i was wondering what you thought about this (and perhaps changing more things to be like this) i also noticed that you guys are using the deprecated mocking package - is switching to uber's mock library something you're interested in? |
Thank you for initiating this. I'm broadly in support of adding generics if it improves the usability of the client. I will review this PR in more detail.
Yes, that will be great. |
@kishorenc see #158 |
Looks good, PR ready to merge? |
I mean, the PR with the change to Uber's |
yep, that one is good to merge. |
there's probably an argument to make the default type the reason is because
the reasons against are the same as the reasons for
personally i think i still prefer map[string]any - typesense documents are objects and showing that seems appropriate |
I think using The PR looks fine, but can you please show what type of change will be required for someone to use the updated interface? Would you be able to show a small before/after snippet for a sample collection with one to two fields. Also, how we will handle non-200 statuses as well. |
re: non-200 status the functionality is preserved, so there should be no difference for users As for migration to the new interface
all other behavior should be preserved. |
Sorry, let me clarify. Can you give me an example usage where the user creates a custom struct and then passes it to one of the typed functions (say, document.retrieve) and get the response as a typed struct? Atleast some of the existing tests should test the typed interface this way. I apologize -- I've not kept up with the Go generics features. |
ah ok. will do when i find some time. |
@kishorenc sorry for delay, i wrote this test. typesense-go/typesense/test/document_test.go Lines 14 to 22 in 31c89a0
does this make sense? |
Thanks, that looks good. Is this branch good to merge? |
it should be, we have been using it fine.
On May 24, 2024, tetra12 ***@***.***> wrote:
@elee1766 <https://github.com/elee1766>
Thanks, that looks good. Is this branch good to merge?
—
Reply to this email directly, view it on GitHub
<#156 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARH66M2LKSEI3LPVOCAPMLZD7PHPAVCNFSM6AAAAABFKBKE7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZQGYZTCOJWGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I've published |
Change Summary
attempt to add generics support to the package.
the goal here is to partially addresses #144
since functionality can be preserved with the type parameter map[string]any, not everything needs to be done at once. additionally, existing behavior can be preserved (although people will have to change their types in code)
some things will be difficult to generify because a large amount of the package relies on openapi code generated types, for which adding generics support might be a much larger undertaking
PR Checklist