Open
Description
Is your feature request related to a problem?
Fighting with CBOR for unmarshalling has led me down to this:
res, err := surrealdb.Query[[]struct {
Count int `json:"count"`
}](db, "select count() from $tableName;", map[string]interface{}{
"tableName": tableName,
})
Please implement a proper method for counting? :)
Describe the solution
Counting entries in a database table is one of the most essential parts. One shouldn't need to duke it out with CBOR just to get a proper count - at least, I think so. So, the solution I'd like to propose is to create a top-level function similiar to Insert
and friends, but for Count(db *surrealdb.DB, table models.Table) int
.
Alternative methods
Can't really think of one... sorry.
SurrealDB version
2.0.4
Contact Details
Is there an existing issue for this?
- I have searched the existing issues
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Assignees
Labels
No labels
Activity