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

Query data that includes '@' is not able to be found #58

Open
makluganteng opened this issue Jun 28, 2024 · 1 comment
Open

Query data that includes '@' is not able to be found #58

makluganteng opened this issue Jun 28, 2024 · 1 comment

Comments

@makluganteng
Copy link

i tried querying an email for example

`
// FindAccount retrieves an account by email from the "accounts" table.
func FindAccount(client *supabase.Client, email string) (map[string]interface{}, error) {
var results []map[string]interface{}

err := client.DB.From("accounts").Select("*").Eq("email", email).Execute(&results)
log.Info(results)
if err != nil {
	return nil, err
}

if len(results) == 0 {
	return nil, nil
}

return results[0], nil

}

`

but it keeps returning an empty mapping but when there isnt any symbols it works and it was found. is there something i need to do to handle this kind of things ?

@anku255
Copy link

anku255 commented Sep 18, 2024

I faced the exact same issue and I solved it by using Filter instead of Eq.

You can try doing this -

err := client.DB.From("accounts").Select("*").Filter("email", "eq", email).Execute(&results)
log.Info(results)
if err != nil {
	return nil, err
}

if len(results) == 0 {
	return nil, nil
}

return results[0], nil

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

No branches or pull requests

2 participants