Skip to content

gleam db: get_all_books and get_book_by_id (Read) #19

@HeyItWorked

Description

@HeyItWorked

Sub-issue of #9, depends on #9a (shared helpers)

pub fn get_all_books(conn) -> Result(List(Book), AppError)
pub fn get_book_by_id(conn, id) -> Result(Book, AppError)
  • get_all_books: SELECT id, title, author, status FROM books — return returned.rows directly
  • get_book_by_id: same query with WHERE id = $1 — empty rows → Error(NotFound)

Metadata

Metadata

Assignees

No one assigned

    Labels

    db-layerDatabase/query layergleamGleam implementation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions