Comments (11)
It would be possible, see 1.
We decided to continue development in our own repository as it gives us the opportunity to iterate faster and manage the repository ourselves. You can find the repositories here: Allgeier Secion.
from supabase-go.
Hey @pfennig42 , did you manage to filter results via joined tables? I have the same issue, and it drives me crazy. Would you mind to show me your solution? :)
from supabase-go.
Hi @Ra0k,
I just grabbed this snippet. Does this help you?
supabasecall := supabase.DB.From(table).Select("item,customer!inner(id, short_name, full_name)").Filter(`customer.id`, "eq", "0")
I filled the variables by heart, so I am only 80% sure it works. I would appreaciate the feedback!
from supabase-go.
Hi @pfennig42,
Thank you for the help and the quick response! Unfortunately, for me, the outcome is the same:
if err := supaClient.DB.From("Workspace").Select("id, name, WorkspaceUser!inner(user_id, role)").Filter(`WorkspaceUser.role`, "eq", "admin").Execute(&results); err != nil {
fmt.Println(err)
http.Error(w, "internal server error", http.StatusInternalServerError)
return
}
Output:
42703: column Workspace.WorkspaceUser.role does not exist
Ps:
I only have camel case table names because I was not sure if _ causes problems or not.
from supabase-go.
The only thing I could think about is removing the spaces inside the querys?
Otherwise I would trace the error until Postgres. There should be the translation error
from supabase-go.
I just wonder why it works for you. Do you use the latest version of supabase-go?
In my version (latest). Everything is sanitized.
func SanitizeParam(param string) string {
if strings.ContainsAny(param, reservedChars) {
return fmt.Sprintf("\"%s\"", param)
}
return param
}
func (b *FilterRequestBuilder) Filter(column, operator, criteria string) *FilterRequestBuilder {
if b.negateNext {
b.negateNext = false
operator = "not." + operator
}
b.params.Add(SanitizeParam(column), operator+"."+criteria)
return b
}
As far as I understand, it should always sanitize the input so it should always break the join filtering.
from supabase-go.
Okay, I figured out what happened. Since you opened this issue, this dependency was changed and probably has caused to break this feature. The same happened to #28
from supabase-go.
Alright. Thanks for letting me know!
from supabase-go.
@Ra0k There is currently a known problem with escaped characters in filter functions. Compare with #28.
A temporary solution is to use the generic Filter()
function. This function behaves differently and worked at least for me.
The problem lies indeed not in this repository but here. Currently two main strategies are considered after talking to @nedpals:
- Directly implement the postgrest-go functionality in this repository to speed up development. We would not need releases in two repositories to take effect.
a. We would need to fix the behavior of sanitizing to mimic the official postgrest-js repository . - Use another postgrest-go library that is in a more advanced state and is better maintained.
from supabase-go.
@Fritte795 forgive me the naivety of my question but is it possible to just take the nedpals/postgres-go repo and importing it into this repo and creating a PR?
from supabase-go.
supabasecall := supabase.DB.From(table).Select("item,customer!inner(id, short_name, full_name)").Filter(`customer.id`, "eq", "0")
The filter is for the outer table
:
Filter(`table.id`, "eq", "0")
So would this be right?
Filter(`id`, "eq", "0")
As long as you setup the foreign key relationships in the database it should work.
from supabase-go.
Related Issues (20)
- Auth with PKCE HOT 1
- rpc error HOT 5
- Realtime feature
- Auth issue, anon working HOT 4
- how to select with order by HOT 1
- GORM support
- Select on insert HOT 1
- JWT Token expired Issue HOT 2
- Filter eq with reserved characters does not seem to need %22 HOT 2
- Looking for help to figure out what Supabase functions these RequestBuilder methods connect to? HOT 3
- Add support for Admin HOT 1
- Order query results using request builder
- Postgrest-go Repository HOT 4
- Failed to get Auth.User Token
- Post "/rest/v1/[tableName]": unsupported protocol scheme "" HOT 2
- DELETE requires a WHERE clause HOT 1
- Counting number of rows returned by a SELECT
- Provision redirectTo for the go sdk HOT 1
- How to update user password if the user is not loged in ? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from supabase-go.