.Live[T](table, diff)
Initiate a live query from a SurrealQL statement.
Method Syntaxdb.Live[UUID](table, diff)
Arguments | Description | ||
---|---|---|---|
sql required | Specifies the SurrealQL statements. | ||
cancellationToken optional | The cancellationToken enables graceful cancellation of asynchronous operations. |
package main import ( "fmt" "github.com/surrealdb/surrealdb.go" "github.com/surrealdb/surrealdb.go/pkg/models" ) func main() { // Assuming db is an instance of your database connection table := models.Table("person") diff := true // Whether to receive diffs or not uuid, err := surreal.Live(db, table, diff) if err != nil { fmt.Println("Error initiating live query:", err) return } // Use the UUID for the live query... }