surrealdb / surrealdb

A scalable, distributed, collaborative, document-graph database, for the realtime web
https://surrealdb.com
Other
27.41k stars 892 forks source link

Feature: `is::url()` validator #1432

Closed phisch closed 2 years ago

phisch commented 2 years ago

Is your feature request related to a problem?

Storing URLs is a quite common use-case for databases. Being able to easily validate them would be a good quality of life improvement.

Note: this function was mentioned in #1304, but not implemented.

Describe the solution

The solution would be to implement a url validator function, just like the existing validators. Ideally, the Implementation would follow the whatwg url specification, maybe by relying on an existing crate like url.

Alternative methods

The current alternatives are to either validate using regex, which could lead to incorrect or inconsistent validation, or to use parse::url::domain(value) and check if the result is null, but this isn't optimal either.

SurrealDB version

surreal 1.0.0-beta.8+20220930.c246533 for linux on x86_64

Contact Details

No response

Is there an existing issue for this?

Code of Conduct

tobiemh commented 2 years ago

This is closed in e9615cd5ff29e58d3437f3b6bf848e679644eac2