Expand description
PSL stands for Prisma Schema Language
Overview
This crate is the public API for working with Prisma schemas: parsing and validating their string representation, analyzing them, providing convenient APIs, rendering, reformatting, etc. It is the main implementation of the Prisma Schema Language, and it is used by all Prisma engines in this repository.
The query engine further processes Prisma schemas to produce the client API, and the DMMF JSON format.
Usage
Please see lib.rs
and the rustdoc documentation for the public API.
Main use-case, parsing a string to datamodel:
ⓘ
let file = std::fs::read_to_string(&args[1]).unwrap();
let validated_schema = datamodel::parse_schema(&file)?;
Re-exports
pub use psl_core::diagnostics;
pub use psl_core::parser_database;
pub use psl_core::schema_ast;
Modules
- The interface implemented by connectors for Prisma schema validation and interpretation.
- The implementation of the CLI getConfig() utility and its JSON format.
Structs
- a
datasource
from the prisma schema. - Represents a list of validation or parser errors and warnings.
- A Prisma schema document.
- Either an env var or a string literal.
Enums
Constants
- Generator preview features (alphabetically sorted)
Functions
- Is this a valid type name for the Prisma Client API?
- Parses and validate a schema, but skip analyzing everything except datasource and generator blocks.
- Parse and analyze a Prisma schema.
- Parse a Prisma schema, but skip validations.
- Returns either the reformatted schema, or the original input if we can’t reformat. This happens if and only if the source does not parse to a well formed AST.
- The most general API for dealing with Prisma schemas. It accumulates what analysis and validation information it can, and returns it along with any error and warning diagnostics.
Type Aliases
- The collection of all available connectors.
- A set of preview features.