pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/nativelibs4java/scalaxy-records

assets.com/assets/primer-70be7debc79a8eff.css" /> GitHub - nativelibs4java/scalaxy-records: Macro-powered record abstractions · GitHub
Skip to content

nativelibs4java/scalaxy-records

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scalaxy/Records Build Status

VERY EARLY STAGE, THIS IS A PROOF-OF-CONCEPT

This is an abstraction of how data records can be stored in arrays of columns rather than rows of objects.

import scalaxy.records._

trait User[C[_]] extends Record[User] {
  val name: C[String]
  val birthDate: C[Date]
  val kudosCount: C[Int]
}

// This is a `Int => Record[User]#Array`.
val userFactory: Record[User]#Factory = recordFactory[User]
/* Macro expands to: {
  (size: Int) =>
    new Record[User]#Array {
      val name = new Array[String](size)
      val birthDate = new Array[Date](size)
      val kudosCount = new Array[Int](size)
    }
*/

val userGetters: Record[User]#Getters = recordGetters[User]
/* Macro expands to: {
  new Record[User]#Getters {
    val name = reified {
      (record: Record[User]#Array, row: Int) => record.name(row)
    }
    val birthDate = reified {
      (record: Record[User]#Array, row: Int) => record.birthDate(row)
    }
    val kudosCount = reified {
      (record: Record[User]#Array, row: Int) => record.kudosCount(row)
    }
  }
*/

val n = 10
val users = userFactory(n)
println("name column: " + users.name.toSeq)
println("birthDate column: " + users.birthDate.toSeq)
println("kudosCount column: " + users.kudosCount.toSeq)
for (i <- 0 until n) {
   val name = userGetters.name(users, i)
   println(s"i = $i, name = $name")
}

About

Macro-powered record abstractions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy