Last 30th January 2017 I had the opportunity to give a talk at ScalaMAD MeetUp. The talk I prepared was: Slick 101.
What is Slick? Link to heading
“We don’t try to fight the relational model, we embrace it through a functional paradigm.”
Slick is a library for Scala that makes it easy to work with relational databases. It is not a ORM (Object-Relational Mapping) as other libraries or frameworks like Hibernate. Instead, Slick is a FRM (Functional Relational Mapping), which means it is implemented based on functional programming. Then main difference between FRM and ORM is that FRM does not hide the database in an abstraction layer like ORM. It gives us full control of our database and all the possible operations. It also works asynchronously, which makes Slick a perfect library for reactive applications
What was the content? Link to heading
The main purpose of this talk was to introduce the core concepts to start working with Slick. To do it, we show how this library offers all database data as collections (
Collections) from Scala, and what the advantages are of managing this collections from a functional programming point of view.
The content of the presentation was:
- What is Slick?
- Plain SQL
- Slick DSL
- Defining our Schema
- Slick Operations
- Operating with database
- Selecting data
- Inserting data
- Deleting data
- Updating data
- Combining Actions