surql-definition
surql-definition is a Rust crate that provides a unified interface for generating SurrealDB table and field definitions. It re-exports functionality from surql-definition-macros and surql-definition-core.
Table of Contents
Features
- Re-exports the
SurQLDefinitionderive macro fromsurql-definition-macros. - Re-exports the
SurQLSchemaProducertrait fromsurql-definition-core. - Simplifies the process of defining and validating SurrealDB schemas.
Installation
Add surql-definition to your Cargo.toml:
[]
= "0.1.0"
Usage
To use surql-definition, import the relevant items as needed:
use ;
Examples
Defining a SurrealDB Table
The following example demonstrates how to use the SurQLDefinition macro to define a SurrealDB table:
use SurQLDefinition;
assert_eq!;
Using SurQLSchemaProducer
The SurQLSchemaProducer trait allows you to manually implement a schema query for a struct:
use SurQLSchemaProducer;
;
assert_eq!;
Validation
surql-definition supports runtime and compile-time validation of generated queries through the features provided by surql-definition-macros.
To enable validation, update your Cargo.toml:
[]
= { = "0.1.0", = ["runtime_query_validation"] }
License
This project is licensed under the MIT License. See the LICENSE file for details.