Models
This section provides guidelines for defining and managing data models within Biyard Rust projects. Models represent structured data closely aligned with database entities and API responses, ensuring clear, maintainable, and efficient data handling across different layers of the application.
The goals of this section include:
- Standardizing the definition of database models.
- Providing consistent patterns for API request and response data structures.
- Simplifying data validation, serialization, and integration with database queries.
To achieve these goals, we extensively use the api_model
macro, which streamlines model definitions by automatically generating serialization, validation, and database integration logic.
Detailed explanations and practical examples of using the api_model
macro are provided in the subsections.