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: Further define thing on db.create/merge/delete/select #218

Open
2 tasks done
knackstedt opened this issue Mar 10, 2024 · 2 comments
Open
2 tasks done
Labels
documentation Improvements or additions to documentation

Comments

@knackstedt
Copy link

Description

When writing code to interface with the database, the db client refers to thing as a table or record name throughout the operations. It's unclear what the format of this string should be, in case that there are special symbols that must be escaped or which symbols act as delimiters for the table name/record ID.
I propose that there should be either a link to an explanation or an inline explanation for the format of this string to prevent developer confusion over the format of this field.

I encountered this by debugging an issue here where I had a record with a random string that would randomly fail to insert when the string generated with a dash.

As seen on the delete method (for example), it says table name or record ID, but it doesn't specify the format that the record ID needs to be in.
image

Notably, the thing property behaves differently with the create action, where it will insert records that do not get inserted on the merge action. This different behavior isn't mentioned or obvious, so it may cause problems if the format of thing isn't clear to the developer.
Code:
image
Surrealist:
image

Thanks :D

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
@knackstedt knackstedt added the documentation Improvements or additions to documentation label Mar 10, 2024
@kearfy
Copy link
Member

kearfy commented Apr 20, 2024

Hey @knackstedt! In the new v1.0.0-beta.x we have introduced a RecordId class. This means you can pass a string as a table to these methods, or a RecordId class representing... a RecordId. I still need to update the jsdoc blocks as they are a bit out of date, so I'll leave this issue open for the moment. Hope that helps!

@knackstedt
Copy link
Author

Excellent!
It's a bit foreign to me to use a RecordId class, but if it's well-documented then that's a non-issue. This definitely seems like a solid improvement :)

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

2 participants