File tree Expand file tree Collapse file tree 1 file changed +62
-2
lines changed Expand file tree Collapse file tree 1 file changed +62
-2
lines changed Original file line number Diff line number Diff line change 1- Sqlite.Ecto
1+ Sqlite.Ecto [ ![ Build Status ] ( https://travis-ci.org/jazzyb/sqlite_ecto.svg?branch=master " Build Status ")] ( https://travis-ci.org/jazzyb/sqlite_ecto )
22==========
33
4- ** TODO: Add description **
4+ ` Sqlite.Ecto ` is a SQLite3 Adapter for Ecto. Here is an example usage:
5+
6+ ``` elixir
7+ # In your config/config.exs file
8+ config :my_app , Repo , database: " db/ecto_simple.sqlite3"
9+
10+ # In your application code
11+ defmodule Repo do
12+ use Ecto .Repo ,
13+ otp_app: :my_app ,
14+ adapter: Sqlite .Ecto
15+ end
16+
17+ defmodule Weather do
18+ use Ecto .Model
19+
20+ schema " weather" do
21+ field :city # Defaults to type :string
22+ field :temp_lo , :integer
23+ field :temp_hi , :integer
24+ field :prcp , :float , default: 0.0
25+ end
26+ end
27+
28+ defmodule Simple do
29+ import Ecto .Query
30+
31+ def sample_query do
32+ query = from w in Weather ,
33+ where: w.prcp > 0 or is_nil (w.prcp),
34+ select: w
35+ Repo .all (query)
36+ end
37+ end
38+ ```
39+
40+ ## Usage
41+
42+ Add Tds as a dependency in your ` mix.exs ` file.
43+
44+ ``` elixir
45+ def deps do
46+ [{:sqlite_ecto , " ~> 0.1" }]
47+ end
48+ ```
49+
50+ You should also update your applications list to include both projects:
51+ ``` elixir
52+ def application do
53+ [applications: [:logger , :sqlite_ecto , :ecto ]]
54+ end
55+ ```
56+
57+ To use the adapter in your repo:
58+ ``` elixir
59+ defmodule MyApp .Repo do
60+ use Ecto .Repo ,
61+ otp_app: :my_app ,
62+ adapter: Sqlite .Ecto
63+ end
64+ ```
You can’t perform that action at this time.
0 commit comments