supabase-go icon indicating copy to clipboard operation
supabase-go copied to clipboard

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

Open makluganteng opened this issue 1 year ago • 1 comments

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 ?

makluganteng avatar Jun 28 '24 07:06 makluganteng

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

anku255 avatar Sep 18 '24 18:09 anku255