Chapter 4 of the Discover Goravel track

The logbook

Read, write and update a SQLite table with Goravel's query builder: facades.DB().

3 exercises · 300 XP · about 1 h

This chapter works on: Query builderSQLitedb tagError handlingInsertType conversionUpdatePATCH204

The chapter's exercises

  1. The delivery logbook

    Exercise 1 · 100 XP · 3 objectives checked by tests

    The in-memory round is wiped at every restart, and Margot loses her orders. Her nephew opened a logbook: a SQLite table livraisons, with today's round and the Épicerie de la Lune, a grocery store that just signed up. In a real project, the table would keep everything; here, in the browser, database/carnet.go resets it at every start. He also added an erreurServeur (“server error”) function to the controller, which responds 500.

    Query builderSQLitedb tagError handling

  2. Writing to the logbook

    Exercise 2 · 100 XP · 2 objectives checked by tests

    The logbook can be read; now it needs to be written to: an order taken in the app must go into the table, not just into memory.

    Query builderInsertType conversion

  3. Delivered!

    Exercise 3 · 100 XP · 4 objectives checked by tests

    Margot's last request: once a courier has dropped off a parcel, they tap “Delivered” in the app, and the app files it with the finished deliveries.

    Query builderUpdatePATCH204