SurrealDB Docs Logo

Enter a search query

.Create[T](table, data)

Creates a record in the database.

Method Syntax
db.Create[T](table, data)

Arguments

ArgumentsDescription
table required

The table name or a RecordId to create.

data optional

The document / record data to insert.

Example usage

// Create an entry person1, err := surrealdb.Create[Person](db, models.Table("persons"), map[interface{}]interface{}{ "Name": "John", "Surname": "Doe", "Location": models.NewGeometryPoint(-0.11, 22.00), }) if err != nil { panic(err) } fmt.Printf("Created person with a map: %+v\n", person1)

On this page

© SurrealDB GitHub Discord Community Cloud Features Releases Install