Using PostgreSQL as an Append-only Datastore with Kotlin and Exposed

Опубликовано: 24 Февраль 2023
на канале: Pairing with Duncan
1,198
39

In our last episode (   • PostgreSQL and Exposed - Kotlin datab...  ) we worked out how to save stock items in PostgreSQL (https://www.postgresql.org/) using the JetBrains Exposed library (https://github.com/JetBrains/Exposed). This time we refactor our existing file-based storage, extracting an interface that we can implement with files, in-memory, or with Exposed.

For the database version, instead of replacing items in a table when they change, we choose to implement an append-only datastore. This keeps all the old versions of every row, using a query to select the latest versions when we want to see the current state. This has the advantage that we can rebuild the state of our system if things go wrong, and may also be faster than amending when we consider transactions.

This is part 62 of an exploration of where a Test Driven Development implementation of the Gilded Rose stock control system might take us in Kotlin. You can see the whole series as a playlist
   • All Gilded Rose Episodes  
and the code on GitHub
https://github.com/dmcg/gilded-rose-tdd

If you like this, you’ll probably like my book Java to Kotlin, A Refactoring Guidebook
(http://java-to-kotlin.dev). It's about far more than just the syntax differences between the languages - it shows how to upgrade your thinking to a more functional style.

I have some free time between producing videos and working for team Gilded Rose. If you like these videos I'd like to work with you - please get in touch - [email protected]


Смотрите видео Using PostgreSQL as an Append-only Datastore with Kotlin and Exposed онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Pairing with Duncan 24 Февраль 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 1,198 раз и оно понравилось 39 людям.