Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
doc
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

About

No description, website, or topics provided.

Resources

License

Releases

No releases published

Packages

No packages published