No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc
spec
src
.gitignore
.guardian.yml
.travis.yml
LICENSE
README.md
miner
shard.yml

README.md

miner

A standalone SQL ORM library for Crystal

IMPORTANT: This library is still under heavy development, and is far from ready for use in your Crystal projects.

Todo List

  • Query Builder
  • Execute Queries
  • Models
  • Collections
  • Auto-discovery of relationships
  • Auto-casting of field values based on column type

Installation

Add this to your application's shard.yml:

dependencies:
  miner:
    github: molovo/miner

Usage

require "miner"

# Create a config object
config = Miner::Config.new({
  "name" => "my_database",
  "username" => "foo",
  "password" => "bar"
})

# Set the default database
Miner.set_default_database Miner::Database.new(config)

# Create a query
query = Miner::Query.new("countries")
  .select("name", "population")
  .join("city")
    .select({"name", "capital"})
    .on("id", "=", "parent.capital")

# Fetch the results
countries = query.fetch # => Miner::Collection

# Output the result set as JSON
puts countries.to_json

Development

TODO: Write development instructions here

Contributing

  1. Fork it ( https://github.com/[your-github-name]/miner/fork )
  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 a new Pull Request

Contributors