liveBook · Manning

FromRow

FromRow is a type-class or trait abstraction for converting a database query result row into a typed program value.

How 2 Manning books explain it

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.

Read how Learn Haskell by Example explains FromRow →

Related concepts

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.