Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: Please give examples in the Readme of how to use each command #157

Open
2 tasks done
nickchomey opened this issue Oct 9, 2024 · 0 comments
Open
2 tasks done
Labels
documentation Improvements or additions to documentation

Comments

@nickchomey
Copy link

Description

It would be useful if you could provide some examples in the readme for how to use each function - both when passing structs and map/surrealdb.O, as well as if we want to receive/store the result or not.

For example, I'm having trouble using the Insert command/function. In particular, it seems that we must provide a result struct for TResult. But I dont want to receive any result - I just want it to insert and return any error that might happen.

It seems like I have to do something like

type InsertResult struct {
		
}

if _, err := surrealdb.Insert[InsertResult](d.db, models.Table(tableName), payloads); err != nil {

Is there any way to avoid this, for simplicity?

Perhaps more importantly, how do we use these functions when we have a schemaless table? It is hard to provide a schema/struct if a table is schemaless/of unknown schema

Should we be just providing an empty interface, like this?

if _, err := surrealdb.Insert[interface{}](d.db, models.Table(tableName), payloads); err != nil {

If so, it seems like there must be a way to make this cleaner/simpler.

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
@nickchomey nickchomey added the documentation Improvements or additions to documentation label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant