Skip to content

Commit ffcb734

Browse files
authored
Add hex.pm package info (#4)
1 parent fee6dc7 commit ffcb734

File tree

4 files changed

+68
-6
lines changed

4 files changed

+68
-6
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
</picture>
1313
</a>
1414

15-
[![License - Apache 2.0](https://img.shields.io/badge/license-Apache_2.0-blue)](main/LICENSE)
15+
[![License - Apache 2.0](https://img.shields.io/badge/license-Apache_2.0-blue)](./LICENSE)
1616

1717
# PgQuery
1818

1919
An Elixir interface to the [lib_pg_query postgres query parser](https://github.com/pganalyze/libpg_query).
2020

21-
``` elixir
21+
```elixir
2222
{:ok, ast} = PgQuery.parse("select * from a_table")
2323
```
2424

@@ -39,7 +39,7 @@ end
3939

4040
## License
4141

42-
This Elixir interface is distributed under the terms of the [Apache 2.0 license](LICENSE).
42+
This Elixir interface is distributed under the terms of the [Apache 2.0 license](./LICENSE).
4343

4444
The codebase also contains a git-subtree snapshot of [lib_pg_query](https://github.com/pganalyze/libpg_query) which is distributed under the [BSD 3-Clause license](https://github.com/pganalyze/libpg_query/blob/15-latest/LICENSE).
4545

lib/pg_query.ex

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
defmodule PgQuery do
2+
@type error() :: %{message: String.t(), cursorpos: non_neg_integer()}
3+
@doc """
4+
Parses the binary statement `stmt` into a Protobuf AST.
5+
6+
Raises if the statement is invalid.
7+
"""
8+
@spec parse!(String.t()) :: %PgQuery.ParseResult{} | no_return()
29
defdelegate parse!(stmt), to: PgQuery.Parser
10+
11+
@doc """
12+
Parses the binary statement `stmt` into a Protobuf AST.
13+
"""
14+
@spec parse(String.t()) :: {:ok, %PgQuery.ParseResult{}} | {:error, error()}
315
defdelegate parse(stmt), to: PgQuery.Parser
416
end

mix.exs

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@ defmodule PgQuery.MixProject do
44
def project do
55
[
66
app: :pg_query_ex,
7-
version: "0.1.0",
87
elixir: "~> 1.13",
8+
version: "0.5.4",
99
start_permanent: Mix.env() == :prod,
1010
compilers: [:elixir_make] ++ Mix.compilers(),
11-
deps: deps()
11+
deps: deps(),
12+
description: description(),
13+
name: "PgQuery",
14+
package: package(),
15+
docs: docs(),
16+
source_url: "https://github.com/electric-sql/pg_query_ex",
17+
homepage_url: "https://electric-sql.com"
1218
]
1319
end
1420

@@ -23,7 +29,45 @@ defmodule PgQuery.MixProject do
2329
defp deps do
2430
[
2531
{:elixir_make, "~> 0.4", runtime: false},
26-
{:protox, "~> 1.7"}
32+
{:protox, "~> 1.7"},
33+
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false}
34+
]
35+
end
36+
37+
defp package do
38+
# Exclude the test files and other bits and bobs to sneak us in under the
39+
# 8MB hex.pm package size limit...
40+
c_src = ~w(
41+
c_src/libpg_query_ex.c
42+
c_src/libpg_query/LICENSE
43+
c_src/libpg_query/Makefile
44+
c_src/libpg_query/README.md
45+
c_src/libpg_query/pg_query.h
46+
c_src/libpg_query/patches
47+
c_src/libpg_query/protobuf
48+
c_src/libpg_query/src
49+
c_src/libpg_query/vendor
50+
)
51+
52+
[
53+
files: ~w(lib .formatter.exs mix.exs README.* LICENSE Makefile) ++ c_src,
54+
licenses: ["Apache-2.0"],
55+
links: %{
56+
"libpg_query" => "https://github.com/pganalyze/libpg_query",
57+
"Github" => "https://github.com/electric-sql/pg_query_ex",
58+
"Electric SQL" => "https://electric-sql.com"
59+
}
60+
]
61+
end
62+
63+
defp description do
64+
"An Elixir interface to the libpg_query postgres query parser. Converts a valid PostgreSQL query into a Protobuf based AST."
65+
end
66+
67+
defp docs do
68+
[
69+
main: "readme",
70+
extras: ["README.md", "LICENSE"]
2771
]
2872
end
2973
end

mix.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
%{
22
"decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
3+
"earmark_parser": {:hex, :earmark_parser, "1.4.41", "ab34711c9dc6212dda44fcd20ecb87ac3f3fce6f0ca2f28d4a00e4154f8cd599", [:mix], [], "hexpm", "a81a04c7e34b6617c2792e291b5a2e57ab316365c2644ddc553bb9ed863ebefa"},
34
"elixir_make": {:hex, :elixir_make, "0.7.5", "784cc00f5fa24239067cc04d449437dcc5f59353c44eb08f188b2b146568738a", [:mix], [{:castore, "~> 0.1", [hex: :castore, repo: "hexpm", optional: true]}], "hexpm", "c3d63e8d5c92fa3880d89ecd41de59473fa2e83eeb68148155e25e8b95aa2887"},
5+
"ex_doc": {:hex, :ex_doc, "0.34.2", "13eedf3844ccdce25cfd837b99bea9ad92c4e511233199440488d217c92571e8", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "5ce5f16b41208a50106afed3de6a2ed34f4acfd65715b82a0b84b49d995f95c1"},
6+
"makeup": {:hex, :makeup, "1.1.2", "9ba8837913bdf757787e71c1581c21f9d2455f4dd04cfca785c70bbfff1a76a3", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cce1566b81fbcbd21eca8ffe808f33b221f9eee2cbc7a1706fc3da9ff18e6cac"},
7+
"makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"},
8+
"makeup_erlang": {:hex, :makeup_erlang, "1.0.1", "c7f58c120b2b5aa5fd80d540a89fdf866ed42f1f3994e4fe189abebeab610839", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "8a89a1eeccc2d798d6ea15496a6e4870b75e014d1af514b1b71fa33134f57814"},
9+
"nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"},
410
"protox": {:hex, :protox, "1.7.2", "ed800ae523fa7b7e68a411645922c8061daacfa57aacff2a38d63aa092304a8c", [:mix], [{:decimal, "~> 1.9 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "02230413186776adac7d05237e17e4d20e69b270ae086fab6f1fffda8094d9b0"},
511
}

0 commit comments

Comments
 (0)