FsCassy


Functional F# API for Cassandra

FsCassy offers several improvements for F# expereience over the .NET driver: F# quotations support for statically-typed update queries, a composable DSL for statements and Cassandra and an InMem statement interpreters. The pluggbale interpreter extends the reach of unit-testing into the code that would not be otherwise testable in isolation.

Installing

The FsCassy library can be installed from NuGet:
PM> Install-Package FsCassy

Example

This example demonstrates the functional language defined by FsCassy:

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
#r "FsCassy.dll"
#r "Cassandra.dll"
open FsCassy

// Some table we have mapped to a type
type SomeMappedTableType = {x:int}

// a composed statement, if pass it to an interpreter, we'll get Async<unit> back
let exampleUpdateIf : Statement<SomeMappedTableType,_> =
        table
    >>= where (Quote.X(fun x -> x.x = 0))
    >>= select (Quote.X(fun x -> { x with x = 10}))
    >>= updateIf (Quote.X(fun x -> x.x = 0))
    >>= withConsistency Consistency.Quorum
    >>= execute

Samples & documentation

  • Tutorial goes into more details.

  • API Reference contains automatically generated documentation for all types, modules and functions in the library. This includes additional brief samples on using most of the functions.

Contributing and copyright

The project is hosted on GitHub where you can report issues, fork the project and submit pull requests.

The library is available under Apache license, which allows modification and redistribution for both commercial and non-commercial purposes. For more information see the License file in the GitHub repository.

Copyright 2017 et1975 Technologies Inc

type SomeMappedTableType =
  {x: int;}

Full name: Index.SomeMappedTableType
SomeMappedTableType.x: int
Multiple items
val int : value:'T -> int (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.int

--------------------
type int = int32

Full name: Microsoft.FSharp.Core.int

--------------------
type int<'Measure> = int

Full name: Microsoft.FSharp.Core.int<_>
val exampleUpdateIf : obj

Full name: Index.exampleUpdateIf
Fork me on GitHub