liveBook · Manning

Database operation

As explained in Rust Servers, Services, and Apps

Database access is the set of operations by which application code communicates with a database to store or retrieve data.

A database operation is an application action that stores or retrieves data through a database access layer. In a server-rendered Rust application, this layer separates persistence details from routes and request handlers. section 8.4

A practical application organizes database operations around:

  • Database-access modules for related entities such as courses and tutors. section 6.1
  • Postgres table-creation scripts and environment variables for database access credentials. section 6.1
  • Handlers that validate submitted data and invoke persistence logic when forms arrive through application routes. section 8.4

Tutor registration

A browser submits tutor-registration data to an Actix route. The handler performs complex validation, then uses the database access layer to store user-management data in Postgres; errors can cause the form template to be rendered again. section 8.4

Figure 6.1 Project structure for chapters 5 and 6

Use the project-structure diagram to locate database access alongside handlers, models, routes, state, and database scripts. section 6.1

How Rust Servers, Services, and Apps covers it

How deep it goes
Defines the architectural boundary and project organization but stops short of detailing query implementations.
Examples
Uses course and tutor modules, tutor registration, Postgres table scripts, and submitted HTML forms as concrete artifacts.
What you can do after
Apply it via an Actix web application by separating persistence logic from request handling and organizing entity-specific modules.
How it connects
Connects database access layers with routes, handlers, models, HTML forms, validation, and Postgres.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Rust Servers, Services, and Apps. The section links point to the parts of the book it draws on.