# PhaseDB
A real-time time series database.
[](https://codeship.com/projects/140769)
[](https://hex.pm/packages/phasedb)
## Installation
PhaseDB is available as a hex package:
1. Add phasedb to your list of dependencies in `mix.exs`:
def deps do
[{:phasedb, "~> 0.0.1"}]
end
2. Ensure phasedb is started before your application:
def application do
[applications: [:phasedb]]
end
## Status
PhaseDB is in very early development.
## Examples
### Creating a database.
```elixir
alias PhaseDB.Database
"foo"
|> Database.create
```
### Creating a series.
```elixir
alias PhaseDB.{Database, Series}
"foo"
|> Database.get
|> Series.create("bar")
```
### Inserting data
```elixir
alias PhaseDB.Query
import PhaseDB.Insert
use Calendar
insert
|> value(13)
|> recorded_at(DateTime.now_utc)
|> into("foo", "bar")
|> Query.execute
```
### Querying data
```elixir
alias PhaseDB.Query
import PhaseDB.Select
select
|> function(:average, [field(:value)], as: :value)
|> field(:received_at)
|> from("foo", "bar")
|> group_by(20, :mins)
|> Query.execute
```
### Documentation
Full API documentation is available on [hexdocs.pm](https://hexdocs.pm/phasedb)
### Running the tests
PhaseDB uses [espec](https://github.com/antonmi/espec) for unit tests and
[white_bread](https://github.com/meadsteve/white-bread) for acceptance tests.
```
$ mix deps.get
$ mix espec
$ mix white_bread.run
```
## Contributing
1. Fork it ( [https://github.com/jamesotron/phasedb/fork](https://github.com/jamesotron/phasedb/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%