Module schema

Module schema 

Source
Expand description

Schema parsing and AST types.

This module provides everything needed to work with Prax schema files:

§Example

use prax::schema::{parse_schema, validate_schema, PraxConfig};

// Parse a schema
let schema = parse_schema(r#"
    model User {
        id    Int    @id @auto
        email String @unique
    }
"#)?;

// Access schema information
println!("Models: {:?}", schema.model_names().collect::<Vec<_>>());

// Load configuration
let config = PraxConfig::from_file("prax.toml")?;
println!("Database: {}", config.database.provider);

Modules§

ast
Abstract Syntax Tree (AST) types for Prax schemas.
cache
Schema caching for improved performance.
config
Configuration file parsing for prax.toml.
error
Error types for schema parsing and validation.
parser
Schema parser for .prax files.
prelude
Prelude module for convenient imports.
validator
Schema validation and semantic analysis.

Structs§

Attribute
An attribute applied to a field, model, or enum.
AttributeArg
An attribute argument (named or positional).
CacheStats
Statistics for the schema cache.
CompositeType
A composite type definition (for embedded documents / JSON).
Datasource
Datasource configuration block.
DeprecationInfo
Information about a deprecated field.
DocString
An interned documentation string.
DocTag
A documentation tag (like @example, @deprecated, @see).
Documentation
A documentation comment.
EnhancedDocumentation
Enhanced documentation with embedded validation directives.
Enum
An enum definition.
EnumVariant
An enum variant.
FederationConfig
Federation 2.0 configuration for a model.
FederationKey
Federation entity key configuration.
Field
A field in a model or composite type.
FieldAttributes
Common field attributes.
FieldAttrsCache
Cached field attribute values.
FieldMetadata
Comprehensive metadata for a field controlling visibility, deprecation, and API behavior.
FieldPermissions
API operation permissions for a field.
FieldValidation
A collection of validation rules for a field.
GraphQLArgument
A GraphQL directive argument.
GraphQLConfig
GraphQL-specific configuration for a model or type.
GraphQLDirective
A GraphQL directive with arguments.
GraphQLFieldConfig
GraphQL-specific configuration for a field.
Ident
An identifier with source location.
Index
Index definition for a model.
IndexField
A field in an index.
LazyFieldAttrs
Lazily computed field attributes.
Model
A model definition (maps to a database table).
MssqlPolicyStatements
SQL statements generated for MSSQL security policies.
NativeType
Native database type specification.
Policy
A Row-Level Security (RLS) policy definition.
PostgresExtension
A PostgreSQL extension.
PraxConfig
Main configuration structure for prax.toml.
RawSql
A raw SQL definition.
Relation
A resolved relation between two models.
RelationAttribute
Relation attribute details.
Schema
A complete Prax schema.
SchemaCache
A cache for parsed schemas.
SchemaStats
Schema statistics for debugging/info.
Server
An individual server within a server group.
ServerGroup
A server group containing multiple database servers.
ServerProperty
A server property key-value pair.
Span
A span in the source code for error reporting.
SubscriptionConfig
GraphQL subscription configuration.
ValidationRule
A validation rule for a field.
ValidationTypePool
Pool of commonly used validation types.
Validator
Schema validator for semantic analysis.
View
A view definition (read-only model mapping to a database view).

Enums§

AttributeValue
An attribute argument value.
ComplexityConfig
Query complexity configuration.
DatabaseProvider
Database provider type.
FieldType
A field type in the schema.
GraphQLValue
A GraphQL value for directive arguments.
IndexType
Index type.
LoadBalanceStrategy
Load balancing strategy for distributing queries.
ModelStyle
Style of model code generation.
MssqlBlockOperation
MSSQL-specific block operation types.
PolicyCommand
PostgreSQL policy command type.
PolicyType
PostgreSQL policy type.
ReferentialAction
Referential actions for relations.
RelationType
The type of relation between two models.
ScalarType
Scalar types supported by Prax.
SchemaError
Errors that can occur during schema parsing and validation.
ServerGroupStrategy
Server group strategy.
ServerPropertyValue
Server property value types.
ServerRole
Server role within a group.
SortOrder
Sort order for index fields.
TypeModifier
Modifier for field types.
ValidationType
Types of validation rules.
ValidationValue
A value that can be used in validation rules.
VectorOps
Vector distance operation for similarity search.
Visibility
Visibility level for a field or model.
WellKnownExtension
Well-known PostgreSQL extensions with their capabilities.

Functions§

parse_graphql_config_from_tags
Parse GraphQL configuration from doc tags.
parse_graphql_field_config_from_tags
Parse field GraphQL configuration from doc tags.
parse_schema
Parse a schema from a string.
parse_schema_file
Parse a schema from a file.
validate_schema
Validate a schema string and return the validated schema.

Type Aliases§

SchemaResult
Result type for schema operations.