CodeLionX / actordb

Actor Database System Framework using Akka
MIT License
0 stars 2 forks source link

Fluent interface for Relation #42

Closed CodeLionX closed 6 years ago

CodeLionX commented 6 years ago

Issue

Add a new TransientRelation extends Relation for providing a fluent interface for dealing with Relations. Instantiation of TransientRelations should be only possible within the framework. It must not be visible outside of the framework as it only provides an implementation of all Relation's functions.

Problem Description

Most functions of Relation just return a Seq[Records]. So method chaining is not possible and we must fallback to functions on Seq:

val result: Seq[Records] = User
  .where(User.id => { _ == 22 })
  .map(_.project(Seq(User.id, User.name)).get)
  .sortBy(_.get(User.name))

Supporting Information

Desired syntax:

val result: Seq[Records] = User
  .where(User.id => { _ == 22 })
  .project(Seq(User.id, User.name))
  .orderBy(User.name)
  .records
CodeLionX commented 6 years ago

further changes in #45 and #46