.Version()
Retrieves the version of the SurrealDB instance.
Method Syntax
db.Version()
Arguments
| Arguments | Description |
|---|
cancellationToken optional | The cancellationToken enables graceful cancellation of asynchronous operations. |
Example usage
package main
import (
"fmt"
)
func ExampleVersion() {
db, err := surrealdb.New("ws://localhost:8000")
if err != nil {
panic(err)
}
if err = db.Use("test", "test"); err != nil {
panic(err)
}
token, err := db.SignIn(&surrealdb.Auth{
Username: "root",
Password: "root",
})
if err != nil {
panic(err)
}
if err = db.Authenticate(token); err != nil {
panic(err)
}
v, err := ws.Version()
if err != nil {
panic(err)
}
fmt.Printf("VersionData (WebSocket): %+v\n", v)
http := newSurrealDBHTTPConnection("version")
v, err = http.Version()
if err != nil {
panic(err)
}
fmt.Printf("VersionData (HTTP): %+v\n", v)
}