.New()
Connects to a remote database endpoint.
Method Syntaxsurrealdb.New(url, options...)()
Arguments | Description | ||
---|---|---|---|
url required | The URL of the database endpoint to connect to. Examples may include http://hostname:8000 or ws://hostname:8000/rpc . | ||
options optional | Set SurrealDB clients options such as Timeout etc. |
// Connect to a local endpoint surrealdb.New("ws://localhost:8000"); // Connect to a remote endpoint surrealdb.New("ws://cloud.surrealdb.com");
db, err := surrealdb.New("ws://localhost:8000") if err != nil { panic(err) }