supabase-community / postgrest-go

Isomorphic Go client for PostgREST. (Now Updating)
https://supabase.io
Apache License 2.0
170 stars 27 forks source link

Inaccurate code comments on method ExecuteTo #55

Open Phil-CST-BCIT opened 1 month ago

Phil-CST-BCIT commented 1 month ago

Improve documentation

Link

Add a link to the page which needs improvement (if relevant)

https://github.com/supabase-community/postgrest-go/blob/main/querybuilder.go#L44

Describe the problem

Is the documentation missing? Or is it confusing? Why is it confusing?

The comments on the method func (q *QueryBuilder) ExecuteTo(to interface{}) state that the acceptable argument to is always a slice, but this is not true if the user specifies vnd.pgrst.object to be part of the Accept header (see: https://docs.postgrest.org/en/v12/references/api/resource_representation.html#singular-or-plural).

Describe the improvement

A clear and concise description of the improvement.

Update the current comments to capture the fact:

// interface. Note that the argument for the to parameter should always be a // reference to a slice unless the method Single is specified.

Additional context

Add any other context or screenshots that help clarify your question.