Most developers will sooner or later need to interact with some database from within the application. We then reach for an established Object Relational mapping or Functional Relational Mapping library of our choice.
Those are frameworks and libraries that help us interact with the database — handle mapping between objects and database’s tables (or graphs, depending on your database), help us with query constructions and so much more.
Scala often gets a reputation for how complicated it is to write and setup and how much boilerplate there is. The same goes for functional programming. My goal is to show you the opposite — how even with limited knowledge of the following topics you can productively use competing libraries in the same field, and how well they fit together. How you can easily treat Kafka topics as streams of data, how simply you can compose SQL statements into a bigger transaction, and overall how productive you can be in today's Scala’s ecosystem.
In this article, we’ll explore implementing typeahead (or in other words, autocomplete) for a real dataset using Completion Suggester. We’ll then create phrases that map to our completion and ask for some suggestions based on the movie’s title. After that, we’ll use contexts to limit our suggestions to only some genres while applying specific boosts per genre.
The goal is an exploration of this feature, its API, and possible usage.
We will be looking into ways of accessing your Gmail via Google API, following it up further with a low-level approach — programmatically via SMTP & XOAuth2. This is a rather uncommon way, as the provided client APIs are sufficient in most cases. Next, we’ll approach cases that are not achievable with Gmail library clients.
This blog has educational purposes and is supplemented by code that demonstrates the principles outlined here. All of the code can be found in this repository.
Before proceeding, we need to get our app’s credentials (one that will perform the authorized actions on your…