SurrealDB Docs Logo

Enter a search query

.New()

Connects to a remote database endpoint.

Method Syntax
surrealdb.New(url, options...)()

Arguments

ArgumentsDescription
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.

Example usage

// 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) }

On this page

© SurrealDB GitHub Discord Community Cloud Features Releases Install