Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit 7f3b4d7

Browse files
mmmriesConnorRigby
authored andcommitted
fix some spacing, fix credo warnings
1 parent d3134ca commit 7f3b4d7

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

lib/sqlitex/sql_builder.ex

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ defmodule Sqlitex.SqlBuilder do
2323
defp table_opt(:temp), do: {:temp, "TEMP"}
2424
defp table_opt({:primary_key, cols}) when is_list(cols) do
2525
{
26-
:primary_key, ",PRIMARY KEY ("
26+
:primary_key, ", PRIMARY KEY ("
2727
# Also quote the columns in a PRIMARY KEY list
28-
<> (cols |> Enum.map(&(~s("#{&1}"))) |> Enum.join(","))
28+
<> (cols |> Enum.map(&(~s("#{&1}"))) |> Enum.join(", "))
2929
<> ")"
3030
}
3131
end
3232
defp table_opt({:primary_key, col}) when is_atom(col) do
33-
{:primary_key, ",PRIMARY KEY (\"" <> Atom.to_string(col) <> "\")"}
33+
{:primary_key, ", PRIMARY KEY (\"" <> Atom.to_string(col) <> "\")"}
3434
end
3535

3636
# Supported column options

test/row_test.exs

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ defmodule Sqlitex.RowTest do
33
import Sqlitex.Row
44

55
test "supports the YYYY-MM-DD HH:MM format" do
6-
[row] = from([:datetime],[:test],[{"1988-02-14 15:17"}], %{})
7-
assert %{test: {{1988,2,14},{15,17,0,0}}} == row
6+
[row] = from([:datetime], [:test], [{"1988-02-14 15:17"}], %{})
7+
assert %{test: {{1988, 2, 14}, {15, 17, 0, 0}}} == row
88
end
99

1010
test "supports the YYYY-MM-DD HH:MM:SS format" do
11-
[row] = from([:datetime],[:test],[{"1988-02-14 15:17:11"}], %{})
12-
assert %{test: {{1988,2,14},{15,17,11,0}}} == row
11+
[row] = from([:datetime], [:test], [{"1988-02-14 15:17:11"}], %{})
12+
assert %{test: {{1988, 2, 14}, {15, 17, 11, 0}}} == row
1313
end
1414

1515
test "supports the YYYY-MM-DD HH:MM:SS.FFF format" do
16-
[row] = from([:datetime],[:test],[{"1988-02-14 15:17:11.123"}], %{})
17-
assert %{test: {{1988,2,14},{15,17,11,123_000}}} == row
16+
[row] = from([:datetime], [:test], [{"1988-02-14 15:17:11.123"}], %{})
17+
assert %{test: {{1988, 2, 14}, {15, 17, 11, 123_000}}} == row
1818
end
1919

2020
test "supports the YYYY-MM-DD HH:MM:SS.FFFFFF format" do
21-
[row] = from([:datetime],[:test],[{"1988-02-14 15:17:11.123456"}], %{})
22-
assert %{test: {{1988,2,14},{15,17,11,123_456}}} == row
21+
[row] = from([:datetime], [:test], [{"1988-02-14 15:17:11.123456"}], %{})
22+
assert %{test: {{1988, 2, 14}, {15, 17, 11, 123_456}}} == row
2323
end
2424

2525
test "parses decimal types" do

test/sql_builder_test.exs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ defmodule SqlBuilderTest do
1414

1515
test "creating a table with a primary key" do
1616
sql = Sql.create_table(:dinosaurs, [primary_key: :id], id: :integer, name: :text)
17-
assert sql == "CREATE TABLE \"dinosaurs\" (\"id\" integer, \"name\" text ,PRIMARY KEY (\"id\"))"
17+
assert sql == "CREATE TABLE \"dinosaurs\" (\"id\" integer, \"name\" text , PRIMARY KEY (\"id\"))"
1818
end
1919

2020
test "creating a table with multiple primary keys" do
2121
sql = Sql.create_table(:dinosaurs, [primary_key: [:id, :type]], id: :integer, type: :integer, name: :text)
22-
assert sql == "CREATE TABLE \"dinosaurs\" (\"id\" integer, \"type\" integer, \"name\" text ,PRIMARY KEY (\"id\",\"type\"))"
22+
assert sql == "CREATE TABLE \"dinosaurs\" (\"id\" integer, \"type\" integer, \"name\" text , PRIMARY KEY (\"id\", \"type\"))"
2323
end
2424

2525
test "creating a table with NOT NULL columns" do

test/sqlitex_test.exs

+5-5
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ defmodule SqlitexTest do
2828
test "server basic query" do
2929
{:ok, conn} = Sqlitex.Server.start_link(@shared_cache)
3030
{:ok, [row]} = Sqlitex.Server.query(conn, "SELECT * FROM players ORDER BY id LIMIT 1")
31-
assert row == [id: 1, name: "Mikey", created_at: {{2012,10,14},{05,46,28,318_107}}, updated_at: {{2013,09,06},{22,29,36,610_911}}, type: nil]
31+
assert row == [id: 1, name: "Mikey", created_at: {{2012, 10, 14}, {05, 46, 28, 318_107}}, updated_at: {{2013, 09, 06}, {22, 29, 36, 610_911}}, type: nil]
3232
Sqlitex.Server.stop(conn)
3333
end
3434

3535
test "server basic query by name" do
3636
{:ok, _} = Sqlitex.Server.start_link(@shared_cache, name: :sql)
3737
{:ok, [row]} = Sqlitex.Server.query(:sql, "SELECT * FROM players ORDER BY id LIMIT 1")
38-
assert row == [id: 1, name: "Mikey", created_at: {{2012,10,14},{05,46,28,318_107}}, updated_at: {{2013,09,06},{22,29,36,610_911}}, type: nil]
38+
assert row == [id: 1, name: "Mikey", created_at: {{2012, 10, 14}, {05, 46, 28, 318_107}}, updated_at: {{2013, 09, 06}, {22, 29, 36, 610_911}}, type: nil]
3939
Sqlitex.Server.stop(:sql)
4040
end
4141

@@ -46,20 +46,20 @@ defmodule SqlitexTest do
4646

4747
test "a basic query returns a list of keyword lists", context do
4848
{:ok, [row]} = Sqlitex.query(context[:golf_db], "SELECT * FROM players ORDER BY id LIMIT 1")
49-
assert row == [id: 1, name: "Mikey", created_at: {{2012,10,14},{05,46,28,318_107}}, updated_at: {{2013,09,06},{22,29,36,610_911}}, type: nil]
49+
assert row == [id: 1, name: "Mikey", created_at: {{2012, 10, 14}, {05, 46, 28, 318_107}}, updated_at: {{2013, 09, 06}, {22, 29, 36, 610_911}}, type: nil]
5050
end
5151

5252
test "a basic query returns a list of maps when into: %{} is given", context do
5353
{:ok, [row]} = Sqlitex.query(context[:golf_db], "SELECT * FROM players ORDER BY id LIMIT 1", into: %{})
54-
assert row == %{id: 1, name: "Mikey", created_at: {{2012,10,14},{05,46,28,318_107}}, updated_at: {{2013,09,06},{22,29,36,610_911}}, type: nil}
54+
assert row == %{id: 1, name: "Mikey", created_at: {{2012, 10, 14}, {05, 46, 28, 318_107}}, updated_at: {{2013, 09, 06}, {22, 29, 36, 610_911}}, type: nil}
5555
end
5656

5757
test "with_db" do
5858
{:ok, [row]} = Sqlitex.with_db(@shared_cache, fn(db) ->
5959
Sqlitex.query(db, "SELECT * FROM players ORDER BY id LIMIT 1")
6060
end)
6161

62-
assert row == [id: 1, name: "Mikey", created_at: {{2012,10,14},{05,46,28,318_107}}, updated_at: {{2013,09,06},{22,29,36,610_911}}, type: nil]
62+
assert row == [id: 1, name: "Mikey", created_at: {{2012, 10, 14}, {05, 46, 28, 318_107}}, updated_at: {{2013, 09, 06}, {22, 29, 36, 610_911}}, type: nil]
6363
end
6464

6565
test "table creation works as expected" do

0 commit comments

Comments
 (0)