Description
Type-safe & compile-time-checked wrapper around the Cassandra driver. That allows you to write raw CQL queries like:
Troy alternatives and similar packages
Based on the "Database" category.
Alternatively, view Troy alternatives based on common mentions on social networks and blogs.
-
PostgreSQL and MySQL async
Async database drivers to talk to PostgreSQL and MySQL in Scala. -
Relate
Lightweight, blazing-fast database access layer for Scala that abstracts the idiosyncricies of the JDBC while keeping complete control over the SQL. -
SwayDB
Type-safe, non-blocking, back-pressured key-value storage library for single/multiple disks & in-memory - www.SwayDB.io -
Scruid
Scruid (Scala+Druid) is an open source library that allows you to compose Druid queries easily in Scala. -
ReactiveCouchbase
Reactive Scala Driver for Couchbase. Also includes a Play plug-in. An official plug-in is also in development. -
lucene4s
Light-weight convenience wrapper around Lucene to simplify complex tasks and add Scala sugar. -
d4s
"Dynamo DB Database done Scala way". A library that allows accessing the DynamoDB in a purely functional way. -
neo4akka
Neo4j Scala client using Akka HTTP with compile-time query interpolation, case class support, true non-blocking IO, and much more. -
GCP Datastore Akka Persistence Plugin
akka-persistence-gcp-datastore is a journal and snapshot store plugin for akka-persistence using Google Cloud Datastore.
Get performance insights in less than 4 minutes
Do you think we are missing an alternative of Troy or a related project?
Popular Comparisons
README
Warning
Last stable code (as preseneted in ScalaExchange 2016) under "v0.5" tag.
The new approach (as presented in ScalaSwarm 2017, and Scala.World 2017) is here (in master branch), however is highly unstable at the moment. If you want something to play with, I recommend checking our POC instead.
What is Troy?
Type-safe & compile-time-checked wrapper around the Cassandra driver. That allows you to write raw CQL queries like:
@schemasafe val q =
query[Search, Result]("""
SELECT x, y, z
FROM test
WHERE x = ? AND y = ?;
""");
Validating them against your schema, defined as below:
@schema object Schema extends SchemaFromString(
"""
CREATE TABLE test (
x text PRIMARY KEY,
y int,
z list<text>
);
"""
)
and showing errors at compile-time like:
Main.scala:15: Column 'ops_typo' not found in table 'test.posts' OR Main.scala:15: Incompatible column type Int <--> troy.driver.CassandraDataType.Text
Check our [examples](examples) for more usecases.
Compile-time Codec registery
Troy wraps Cassandra's codecs in Typeclasses, to allow picking the correct codec at compile-time, rather than runtime.
This is also extensible, by defining an implicit HasTypeCodec[YourType, CassandraType]
.
Optional columns
Troy handles optional values automatically, by wrapping Cassandra's codec with null
checking.
All you need to do is define your classes to contain Option[T]
like.
case class Post(id: UUID, title: Option[String])
CQL Syntax
Troy targets (but not fully implements) CQL v3.4.3
Status
Troy is currently is very early stage, testing, issues and contributions are very welcome.
License
This code is open source software licensed under the [Apache 2.0 License]("http://www.apache.org/licenses/LICENSE-2.0.html").
*Note that all licence references and agreements mentioned in the Troy README section above
are relevant to that project's source code only.