FromRow
FromRow is a type-class or trait abstraction for converting a database query result row into a typed program value.
Rust Servers, Services, and Apps
FromRow is an SQLx trait for constructing a Rust value from a database query result row.
- How it is used
- Maps course query results into `Course` values in a Rust web API’s database-access layer.
- How deep it goes
- Shows a derive and its use with `query_as!`, while leaving trait internals and a handwritten `FromRow` implementation unexplored.
- Examples
- Uses a `Course` struct and tutor-filtered `SELECT`, single-course lookup, and `INSERT ... RETURNING` queries.
- What you can do after
- Apply it via SQLx to derive row mapping for `Course` and return typed results from course database functions.
Read how Rust Servers, Services, and Apps explains FromRow →
Learn Haskell by Example
FromRow is a sqlite-simple type class whose instances define parsing of SQL row data into Haskell values.
- How it is used
- Parses SQLite query results into application-specific Haskell values returned by query and query_.
- How deep it goes
- Defines RowParser construction with FromField and field, then demonstrates explicit and generic instances without detailing custom parser internals.
- Examples
- Demonstrates TodoEntry parsing, query_ returning [TodoEntry], and generic FromRow and ToRow instances.
- What you can do after
- Build it from scratch by defining a FromRow instance that maps ordered SQL columns through field.
Related concepts
- SQLused by · SQL is a standardized declarative language for defining, querying, and manipulating data and structures in relational database systems.
- query_as! macroproduced by · query_as! is an SQLx compile-time macro that maps SQL query results into a specified Rust type and checks the query against the database schema.
- SQLxused by · SQLx is a Rust asynchronous toolkit for interacting with relational databases, mapping query results to Rust types, and optionally checking SQL queries at compile time.
- ToRowcontrasts with · ToRow is a sqlite-simple type class for converting Haskell values into parameters that can be bound to SQL statements.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

