Skip to content

molovo/miner

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

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

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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published