.Select[T, R](resource)
Selects all records in a table, or a specific record, from the database.
Method Syntaxdb.Select[T, R](resource)
Arguments | Description | ||
---|---|---|---|
resource required | The table name (as | ||
T required | The type to deserialize the result into, such as | ||
R required | The type of the |
// Get entry by Record ID person, err := surrealdb.Select[Person, models.RecordID](db, *person1.ID) if err != nil { panic(err) } fmt.Printf("Selected a person by record id: %+v\n", person) // Or retrieve the entire table persons, err := surrealdb.Select[[]Person, models.Table](db, models.Table("persons")) if err != nil { panic(err) } fmt.Printf("Selected all in persons table: %+v\n", persons)