GithubHelp home page GithubHelp logo

scylladb-crystal-driver's Introduction

About

This project aims to build an environment for interoperability and use of ScyllaDB with the Crystal programming language, aiming at building a driver and wrapper for communication.

Installation

Please make sure you have installed the C/C++ Driver for ScyllaDB.

Then add this to your application's shard.yml:

dependencies:
  scylladb:
    github: lanjoni/scylladb-crystal-driver

Documentation

Usage

From the basic example:

require "scylladb/dbapi"

DB.open("scylladb://127.0.0.1/test") do |db|
  db.exec(<<-CQL)
    create table posts (
      id timeuuid primary key,
      title text,
      body text,
      created_at timestamp
    )
  CQL
  db.exec("insert into posts (id, title, body, created_at) values (now(), ?, ?, ?)",
          "Hello World",
          "Hello, World. I have a story to tell.",
          Time.now)
  db.query("select title, body, created_at from posts") do |rs|
    rs.each do
      title = rs.read(String)
      body = rs.read(String)
      created_at = rs.read(Time)
      puts title
      puts "(#{created_at})"
      puts body
    end
  end
end

Please refer to crystal-db for further usage instructions.

Types

scylladb-crystal-driver supports all the DB::Any primitive types plus Int8, Int16 and some additional value types:

  • date maps to ScyllaDB::DBApi::Date
  • time maps to ScyllaDB::DBApi::Time
  • uuid maps to ScyllaDB::DBApi::Uuid
  • timeuuid maps to ScyllaDB:DBApi::TimeUuid

Some of the collection types are also supported:

  • list maps to Array
  • set maps to Set
  • map maps to Hash

Development

After installation is complete run:

$ crystal spec

This command runs the tests to verify that everything is working correctly.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contributors

scylladb-crystal-driver's People

Contributors

lanjoni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

scylladb-crystal-driver's Issues

add: spec

  • Aliases
  • Async
  • Custom
  • DBApi
  • Errors
  • Querying
  • Session

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.