Skip to main content

Module js_codegen

Module js_codegen 

Source
Expand description

JavaScript code generation from ELO validation expressions.

Translates ELO expressions into JavaScript validator functions that can be used for client-side validation, ensuring the same rules apply on both the server (Rust) and the client (browser/Node.js).

§Example

use fraiseql_core::validation::js_codegen::JsCodegen;

let codegen = JsCodegen::new();
let js = codegen.emit_validator("User", "age >= 18 && length(email) > 0");
assert!(js.contains("function validate_User"));

Structs§

JsCodegen
JavaScript code generator for ELO expressions.