Sha256: d0f9599f028301fe406c4e994b56abe9f1f43dad64ad986657d3a68c1e6bae67

Contents?: true

Size: 1.79 KB

Versions: 3

Compression:

Stored size: 1.79 KB

Contents

[![Code Climate](https://codeclimate.com/github/Sandthorn/sandthorn_driver_sequel.png)](https://codeclimate.com/github/Sandthorn/sandthorn_driver_sequel)

# Sandthorn Sequel-driver

A SQL database driver for [Sandthorn](https://github.com/Sandthorn/sandthorn), made with [Sequel](http://sequel.jeremyevans.net/).

## Installation

Add this line to your application's Gemfile:

    gem 'sandthorn_driver_sequel'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install sandthorn_driver_sequel

## Usage

### `SandthornDriverSequel.configure`

Change the global configuration, the default data serialization for events and snapshots are YAML.

Change the serialization of events and snapshots to Oj.

```ruby
SandthornDriverSequel.configure { |conf|
  conf.event_serializer = Proc.new { |data| Oj::dump(data) }
  conf.event_deserializer = Proc.new { |data| Oj::load(data) }
  conf.snapshot_serializer = Proc.new { |data| Oj::dump(data) }
  conf.snapshot_deserializer = Proc.new { |data| Oj::dump(data) }
}
```

### `SandthornDriverSequel.driver_from_connection`

Creates a driver from a Sequel connection. Its possible to send in a block like the one for `configure` to chage configuration for the driver.

```ruby
driver = SandthornDriverSequel.driver_from_connection(connection: Sequel.sqlite)
```

### `SandthornDriverSequel.driver_from_url`

Creates a driver from a Sequel url. Its possible to send in a block like the one for `configure` to change configuration for the driver.

```ruby
driver = SandthornDriverSequel.driver_from_connection(url: "<sequel url string>")
```

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sandthorn_driver_sequel-3.2.0 README.md
sandthorn_driver_sequel-3.1.0 README.md
sandthorn_driver_sequel-3.0.0 README.md