Giter Site home page Giter Site logo

furious's Introduction

Furious: an F# DSL for DBMS-independent query

Furious is a compact DSL for expressing data queries without relying on an underlying language. The idea is instead of reinventing a new dsl, to use the one already present in the F# base libraries - the functions in the Seq module. Consequently, Furious uses quote literals that encode lambdas operating on the dataset that you want to receive. An example:

module Samples =
    open Furious.Meta

    type person = {
        firstname: string
        lastname: string
        homeAddress: address
        altAddresses: address seq
    }
    and address = {
        street1: string
        zip: string
    }

    type personzip = {
        lastname: string
        zip: string
    }

    let db = Datastore()
    // simple filtering
    // select firstname, lastname, homeAddressId from people p left outer join addresses a on p.homeAddressId = a.addressId where a.zip = '60614'
    let (neighbor: person seq) = 
        db.Yield <@ fun people-> Seq.filter (fun p -> p.homeAddress.zip = "60614") people @>

    // count
    // select count(*) from people p left outer join addresses a on p.homeAddressId = a.addressId where a.zip = '60614'
    let (neighbors: int seq) = 
        db.Compute <@ fun people -> Seq.length <| Seq.filter (fun p -> p.homeAddress.zip = "60614") people @>

    // mapping
    // select lastname, zip from from people p left outer join addresses a on p.homeAddressId = a.addressId where a.zip = '60614'
    let (neighborsByZip: personzip seq) = 
        db.Yield <@ fun people -> Seq.collect (fun p -> seq { for address in p.altAddresses -> { lastname = p.lastname; zip = address.zip } }) people @>

This style lets you build type-safe expressions, with the resulting type being the only thing you have to explicitly declare..

Status

Furious is beyond raw right now. That said, it will hopefully pick up steam in the coming weeks. Currently, the plan is to build out basic SQL support, with CouchDB after that.

furious's People

Contributors

kolosy avatar mausch avatar

Stargazers

Nathan Davis avatar

Watchers

Nathan Davis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.