slick

Mocking The Right Way

Reading Time: 3 minutes Mockito is a fun way to perform unit tests, but it’s true potential can only be realised if the underlying layers are designed in such a way that there is no interaction with the internal logic of other components of the application.

Using Microsoft SQL Server with Scala Slick

Reading Time: 3 minutes This blog post shows simple CRUD operations on Microsoft SQL Server using Scala Slick version 3.2.3. You might be thinking what’s really great about it? Duh! But until Scala Slick 3.2.x was released, using commercial databases was within the horizon of an additional closed source package know as Slick Extensions which supported Slick drivers for following databases Oracle IBM DB2 Microsoft SQL Server   Library Continue Reading

Streaming data from PostgreSQL using Akka Streams and Slick in Play Framework

Reading Time: 4 minutes In this blog post I’ll try to explain the process wherein you can stream data directly from PostgreSQL database using Scala Slick (which is Scala’s database access/query library) and Akka Streams (which is an implementation of Reactive Streams specification on top of Akka toolkit) in Play Framework. The process is going to be pretty straightforward in terms of implementation where data is read from one Continue Reading

Reverse engineering using Slick 3.2 and Scala

Reading Time: < 1 minute Sometime, we have requirements for create classes corresponding to the existing database or Sometimes, in our initial phase of project, we are going to design database and tables first, after that, we are going to create classes for mapping our tables. As we know, Slick is a FRM(Functional Relational Mapping) for scala. Its a kind of ORM but for scala, it supports Functional and Reactive Continue Reading

SQL made easy and secure with Slick

Reading Time: 5 minutes Slick stands for Scala Language-Integrated Connection Kit. It is Functional Relational Mapping (FRM) library for Scala that makes it easy to work with relational databases. Slick can be considered as a replacement of writing SQL queries as Strings with a nicer API for handling connections, fetching results and using a query language, which is integrated more nicely into Scala. You can write your database queries Continue Reading

Easiest Way To Insert Scala Collection into PostgreSQL using Slick

Reading Time: 2 minutes Few days ago, I had a scenario, in which I had to insert scala collection into postgreSQL using Slick. My postgreSQL table has some columns with data types such as Arrays, hstore  etc.. I tried to do this using slick, but didn’t get success. After beating my head whole day, I found a solution. I found a slick extension slick-pg, which supports following postgreSQL types:- Continue Reading

Easiest Way To Map Optional Nested Case Class with Slick in Scala

Reading Time: 2 minutes Few days ago, I had a scenario, in which I was supposed to map optional nested case class in slick using Scala. case class Employee(emdId:String,name: String, record: Option[Record]) case class Record(subject: String, mark: Int) I was trying to do this mapping the way, I have explained below. class EmployeeSlickMapping(tag: Tag) extends Table[Employee](tag, “Employee”) { def emdId = column[String](“emdId”) def name = column[String](“name”) def subject = Continue Reading