Skip to content

Commit

Permalink
Small readme edits (#30)
Browse files Browse the repository at this point in the history
Plus clarified a sentence in the template README.
  • Loading branch information
tsg authored Mar 21, 2024
1 parent d67ba7a commit 8cd8d13
Show file tree
Hide file tree
Showing 19 changed files with 2,261 additions and 902 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

## Why Zig?

[Zig](https://ziglang.org/) is a small and simple language that aims to be a "modern C" and make system-level code bases easier to maintain. It provides safe memory management, compilation time code execution (comptime), and a standard library.
[Zig](https://ziglang.org/) is a small and simple language that aims to be a "modern C" and make system-level code bases easier to maintain. It provides safe memory management, compilation time code execution (comptime), and a rich standard library.

Zig can interact with C code quite naturally: it supports the C ABI, can work with C pointers and types directly, it can import header files and even translate C code to Zig code. Thanks to this interoperability, a Postgres extension written in Zig can, theoretically, accomplish anything that a C extension can. This means you get full power AND a modern language and standard library to write your extension.

Expand Down Expand Up @@ -185,6 +185,7 @@ pgzx is currently under heavy development by the [Xata](https://xata.io) team. I
* [ ] Postgres 14
* [ ] Postgres 15
* [ ] Postgres 16
* [x] Postgres 17
* [x] Logging
* [x] Error handling
* [x] Memory context allocators
Expand All @@ -203,7 +204,7 @@ pgzx is currently under heavy development by the [Xata](https://xata.io) team. I
* ...
* [ ] Single list
* [ ] Double list
* [ ] Hash tables
* [x] Hash tables
* Development environment
* [ ] Download and vendor Postgres source code
* [x] Compile example extensions against the Postgres source code
Expand Down Expand Up @@ -456,6 +457,7 @@ This step will take a while. You will find the compiler and library of your loca
## See also

* [pgrx](https://github.com/pgcentralfoundation/pgrx) - Similar project but for Rust, it served as an inspiration for this project.
* [pg_tle](https://github.com/aws/pg_tle) - Trusted Language Extensions for PostgreSQL.

## License

Expand Down
2 changes: 1 addition & 1 deletion docs/data-astNodes.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/data-calls.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/data-comptimeExprs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/data-decls.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/data-exprs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/data-files.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/data-modules.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/data-types.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/src/builtin/builtin.zig.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
<span class="line" id="L2"><span class="tok-comment">/// Zig version. When writing code that supports multiple versions of Zig, prefer</span></span>
<span class="line" id="L3"><span class="tok-comment">/// feature detection (i.e. with `@hasDecl` or `@hasField`) over version checks.</span></span>
<span class="line" id="L4"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> zig_version = std.SemanticVersion.parse(zig_version_string) <span class="tok-kw">catch</span> <span class="tok-kw">unreachable</span>;</span>
<span class="line" id="L5"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> zig_version_string = <span class="tok-str">&quot;0.12.0-dev.2819+65a87ff29&quot;</span>;</span>
<span class="line" id="L5"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> zig_version_string = <span class="tok-str">&quot;0.12.0-dev.3154+0b744da84&quot;</span>;</span>
<span class="line" id="L6"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> zig_backend = std.builtin.CompilerBackend.stage2_llvm;</span>
<span class="line" id="L7"></span>
<span class="line" id="L8"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> output_mode = std.builtin.OutputMode.Exe;</span>
Expand Down
28 changes: 16 additions & 12 deletions docs/src/pgzx/pgzx.zig.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,23 @@
<span class="line" id="L23"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> str = <span class="tok-builtin">@import</span>(<span class="tok-str">&quot;pgzx/str.zig&quot;</span>);</span>
<span class="line" id="L24"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> utils = <span class="tok-builtin">@import</span>(<span class="tok-str">&quot;pgzx/utils.zig&quot;</span>);</span>
<span class="line" id="L25"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> intr = <span class="tok-builtin">@import</span>(<span class="tok-str">&quot;pgzx/interrupts.zig&quot;</span>);</span>
<span class="line" id="L26"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> list = <span class="tok-builtin">@import</span>(<span class="tok-str">&quot;pgzx/list.zig&quot;</span>);</span>
<span class="line" id="L27"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> testing = <span class="tok-builtin">@import</span>(<span class="tok-str">&quot;pgzx/testing.zig&quot;</span>);</span>
<span class="line" id="L28"></span>
<span class="line" id="L29"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> guc = utils.guc;</span>
<span class="line" id="L26"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> testing = <span class="tok-builtin">@import</span>(<span class="tok-str">&quot;pgzx/testing.zig&quot;</span>);</span>
<span class="line" id="L27"></span>
<span class="line" id="L28"><span class="tok-comment">// data structures</span>
</span>
<span class="line" id="L29"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> collections = <span class="tok-builtin">@import</span>(<span class="tok-str">&quot;pgzx/collections.zig&quot;</span>);</span>
<span class="line" id="L30"></span>
<span class="line" id="L31"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> PGError = err.PGError;</span>
<span class="line" id="L32"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> pgRethrow = err.pgRethrow;</span>
<span class="line" id="L33"></span>
<span class="line" id="L34"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> PG_MODULE_MAGIC = fmgr.PG_MODULE_MAGIC;</span>
<span class="line" id="L35"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> PG_FUNCTION_V1 = fmgr.PG_FUNCTION_V1;</span>
<span class="line" id="L36"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> PG_FUNCTION_INFO_V1 = fmgr.PG_FUNCTION_INFO_V1;</span>
<span class="line" id="L37"></span>
<span class="line" id="L38"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> PointerListOf = list.PointerListOf;</span>
<span class="line" id="L31"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> guc = utils.guc;</span>
<span class="line" id="L32"></span>
<span class="line" id="L33"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> PGError = err.PGError;</span>
<span class="line" id="L34"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> pgRethrow = err.pgRethrow;</span>
<span class="line" id="L35"></span>
<span class="line" id="L36"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> PG_MODULE_MAGIC = fmgr.PG_MODULE_MAGIC;</span>
<span class="line" id="L37"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> PG_FUNCTION_V1 = fmgr.PG_FUNCTION_V1;</span>
<span class="line" id="L38"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> PG_FUNCTION_INFO_V1 = fmgr.PG_FUNCTION_INFO_V1;</span>
<span class="line" id="L39"></span>
<span class="line" id="L40"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> list = collections.list;</span>
<span class="line" id="L41"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> PointerListOf = list.PointerListOf;</span>
<span class="line" id="L42"></span>
</code></pre></body>
</html>
46 changes: 24 additions & 22 deletions docs/src/pgzx/pgzx/c.zig.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,30 +133,32 @@
<span class="line" id="L19"></span>
<span class="line" id="L20"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;commands/extension.h&quot;</span>);</span>
<span class="line" id="L21"></span>
<span class="line" id="L22"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;storage/ipc.h&quot;</span>);</span>
<span class="line" id="L23"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;storage/proc.h&quot;</span>);</span>
<span class="line" id="L24"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;storage/latch.h&quot;</span>);</span>
<span class="line" id="L25"></span>
<span class="line" id="L26"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;utils/builtins.h&quot;</span>);</span>
<span class="line" id="L27"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;utils/datum.h&quot;</span>);</span>
<span class="line" id="L28"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;utils/guc.h&quot;</span>);</span>
<span class="line" id="L29"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;utils/guc_hooks.h&quot;</span>);</span>
<span class="line" id="L30"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;utils/guc_tables.h&quot;</span>);</span>
<span class="line" id="L31"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;utils/memutils.h&quot;</span>);</span>
<span class="line" id="L32"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;utils/wait_event.h&quot;</span>);</span>
<span class="line" id="L33"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;utils/jsonb.h&quot;</span>);</span>
<span class="line" id="L34"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;utils/lsyscache.h&quot;</span>);</span>
<span class="line" id="L35"></span>
<span class="line" id="L36"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;access/xact.h&quot;</span>);</span>
<span class="line" id="L22"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;lib/ilist.h&quot;</span>);</span>
<span class="line" id="L23"></span>
<span class="line" id="L24"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;storage/ipc.h&quot;</span>);</span>
<span class="line" id="L25"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;storage/proc.h&quot;</span>);</span>
<span class="line" id="L26"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;storage/latch.h&quot;</span>);</span>
<span class="line" id="L27"></span>
<span class="line" id="L28"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;utils/builtins.h&quot;</span>);</span>
<span class="line" id="L29"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;utils/datum.h&quot;</span>);</span>
<span class="line" id="L30"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;utils/guc.h&quot;</span>);</span>
<span class="line" id="L31"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;utils/guc_hooks.h&quot;</span>);</span>
<span class="line" id="L32"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;utils/guc_tables.h&quot;</span>);</span>
<span class="line" id="L33"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;utils/memutils.h&quot;</span>);</span>
<span class="line" id="L34"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;utils/wait_event.h&quot;</span>);</span>
<span class="line" id="L35"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;utils/jsonb.h&quot;</span>);</span>
<span class="line" id="L36"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;utils/lsyscache.h&quot;</span>);</span>
<span class="line" id="L37"></span>
<span class="line" id="L38"> <span class="tok-comment">// libpq support</span>
<span class="line" id="L38"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;access/xact.h&quot;</span>);</span>
<span class="line" id="L39"></span>
<span class="line" id="L40"> <span class="tok-comment">// libpq support</span>
</span>
<span class="line" id="L39"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;libpq-fe.h&quot;</span>);</span>
<span class="line" id="L40"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;libpq/libpq-be.h&quot;</span>);</span>
<span class="line" id="L41"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;libpqsrv.h&quot;</span>);</span>
<span class="line" id="L42">});</span>
<span class="line" id="L43"></span>
<span class="line" id="L44"><span class="tok-kw">pub</span> <span class="tok-kw">usingnamespace</span> includes;</span>
<span class="line" id="L41"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;libpq-fe.h&quot;</span>);</span>
<span class="line" id="L42"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;libpq/libpq-be.h&quot;</span>);</span>
<span class="line" id="L43"> <span class="tok-builtin">@cInclude</span>(<span class="tok-str">&quot;libpqsrv.h&quot;</span>);</span>
<span class="line" id="L44">});</span>
<span class="line" id="L45"></span>
<span class="line" id="L46"><span class="tok-kw">pub</span> <span class="tok-kw">usingnamespace</span> includes;</span>
<span class="line" id="L47"></span>
</code></pre></body>
</html>
120 changes: 120 additions & 0 deletions docs/src/pgzx/pgzx/collections.zig.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>pgzx/collections.zig - source view</title>
<link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAgklEQVR4AWMYWuD7EllJIM4G4g4g5oIJ/odhOJ8wToOxSTXgNxDHoeiBMfA4+wGShjyYOCkG/IGqWQziEzYAoUAeiF9D5U+DxEg14DRU7jWIT5IBIOdCxf+A+CQZAAoopEB7QJwBCBwHiip8UYmRdrAlDpIMgApwQZNnNii5Dq0MBgCxxycBnwEd+wAAAABJRU5ErkJggg==">
<link rel="icon" href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNTMgMTQwIj48ZyBmaWxsPSIjRjdBNDFEIj48Zz48cG9seWdvbiBwb2ludHM9IjQ2LDIyIDI4LDQ0IDE5LDMwIi8+PHBvbHlnb24gcG9pbnRzPSI0NiwyMiAzMywzMyAyOCw0NCAyMiw0NCAyMiw5NSAzMSw5NSAyMCwxMDAgMTIsMTE3IDAsMTE3IDAsMjIiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwb2x5Z29uIHBvaW50cz0iMzEsOTUgMTIsMTE3IDQsMTA2Ii8+PC9nPjxnPjxwb2x5Z29uIHBvaW50cz0iNTYsMjIgNjIsMzYgMzcsNDQiLz48cG9seWdvbiBwb2ludHM9IjU2LDIyIDExMSwyMiAxMTEsNDQgMzcsNDQgNTYsMzIiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwb2x5Z29uIHBvaW50cz0iMTE2LDk1IDk3LDExNyA5MCwxMDQiLz48cG9seWdvbiBwb2ludHM9IjExNiw5NSAxMDAsMTA0IDk3LDExNyA0MiwxMTcgNDIsOTUiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwb2x5Z29uIHBvaW50cz0iMTUwLDAgNTIsMTE3IDMsMTQwIDEwMSwyMiIvPjwvZz48Zz48cG9seWdvbiBwb2ludHM9IjE0MSwyMiAxNDAsNDAgMTIyLDQ1Ii8+PHBvbHlnb24gcG9pbnRzPSIxNTMsMjIgMTUzLDExNyAxMDYsMTE3IDEyMCwxMDUgMTI1LDk1IDEzMSw5NSAxMzEsNDUgMTIyLDQ1IDEzMiwzNiAxNDEsMjIiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwb2x5Z29uIHBvaW50cz0iMTI1LDk1IDEzMCwxMTAgMTA2LDExNyIvPjwvZz48L2c+PC9zdmc+">
<style>
body{
font-family: system-ui, -apple-system, Roboto, "Segoe UI", sans-serif;
margin: 0;
line-height: 1.5;
}

pre > code {
display: block;
overflow: auto;
line-height: normal;
margin: 0em;
}
.tok-kw {
color: #333;
font-weight: bold;
}
.tok-str {
color: #d14;
}
.tok-builtin {
color: #005C7A;
}
.tok-comment {
color: #545454;
font-style: italic;
}
.tok-fn {
color: #900;
font-weight: bold;
}
.tok-null {
color: #005C5C;
}
.tok-number {
color: #005C5C;
}
.tok-type {
color: #458;
font-weight: bold;
}
pre {
counter-reset: line;
}
pre .line:before {
counter-increment: line;
content: counter(line);
display: inline-block;
padding-right: 1em;
width: 2em;
text-align: right;
color: #999;
}

.line {
width: 100%;
display: inline-block;
}
.line:target {
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
background: #fafafa;
}

@media (prefers-color-scheme: dark) {
body{
background:#222;
color: #ccc;
}
pre > code {
color: #ccc;
background: #222;
border: unset;
}
.line:target {
border-top: 1px solid #444;
border-bottom: 1px solid #444;
background: #333;
}
.tok-kw {
color: #eee;
}
.tok-str {
color: #2e5;
}
.tok-builtin {
color: #ff894c;
}
.tok-comment {
color: #aa7;
}
.tok-fn {
color: #B1A0F8;
}
.tok-null {
color: #ff8080;
}
.tok-number {
color: #ff8080;
}
.tok-type {
color: #68f;
}
}
</style>
</head>
<body>
<pre><code><span class="line" id="L1"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> list = <span class="tok-builtin">@import</span>(<span class="tok-str">&quot;collections/list.zig&quot;</span>);</span>
<span class="line" id="L2"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> slist = <span class="tok-builtin">@import</span>(<span class="tok-str">&quot;collections/slist.zig&quot;</span>);</span>
<span class="line" id="L3"><span class="tok-kw">pub</span> <span class="tok-kw">const</span> dlist = <span class="tok-builtin">@import</span>(<span class="tok-str">&quot;collections/dlist.zig&quot;</span>);</span>
<span class="line" id="L4"></span>
</code></pre></body>
</html>
Loading

0 comments on commit 8cd8d13

Please sign in to comment.