Closed Shalankwa closed 11 months ago
Hopefully this illustrates how to:
func main() {
// Or some other type of struct
var results []struct {
Id int64 `json:"id"`
}
ctx := context.Background()
supabase := supa.CreateClient(supabase_url, supabase_key)
// This will always return an array of results
err := supabase.DB.From(tableName).Insert(row).ExecuteWithContext(ctx, &results)
if err != nil {
log.Fatal(err.Error())
}
log.Debugf("results: %#v", results)
log.Info(results[0].Id)
}
Hi, I'm curious how to get the ID of an inserted row.
For other SDK it looks like you perform a .Select() after the insert, but this doesn't look to be supported here.
Offical js SDK
Expected - supabase-go
supabase.DB .From("Table") .Insert(row) .Select() .Execute(&result)