SurrealDB Docs Logo

Enter a search query

.Query()

Runs a set of SurrealQL statements against the database.

Method Syntax
db.Query[TResult any](sql string, vars map[string]interface{}) (*[]QueryResult[TResult], error)

Arguments

ArgumentsDescription
sql required

Specifies the SurrealQL statements.

vars optional

Assigns the value to the variable name.

Example usage

result, err := db.Query("SELECT * FROM type::table($tb)", map[string]interface{}{"tb": "person"})

On this page

© SurrealDB GitHub Discord Community Cloud Features Releases Install