Skip to content

Commit 51d84a6

Browse files
authored
Dynahash: init support for Postgres Hash tables. (#22)
Add typed wrappers for postgres HTAB type (`dynahash` hash tables that can also be used with shared memory). When using HTAB one confiures an 'Entry' that can be any kind of struct. The prefix (first field) of the struct is supposed to hold the key. For string keys this means that we have to configure a max string length.
1 parent 7cee49b commit 51d84a6

File tree

8 files changed

+640
-33
lines changed

8 files changed

+640
-33
lines changed

src/pgzx.zig

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,32 @@
55

66
const std = @import("std");
77

8-
// pub const Build = @import("pgzx/build.zig");
9-
108
// Export common set of postgres headers.
119
pub const c = @import("pgzx/c.zig");
1210

1311
// Utility functions for working with the PostgreSQL C API.
1412
pub const bgworker = @import("pgzx/bgworker.zig");
13+
14+
pub const collections = @import("pgzx/collections.zig");
15+
pub const PointerListOf = collections.list.PointerListOf;
16+
pub const SList = collections.slist.SList;
17+
pub const DList = collections.dlist.DList;
18+
pub const HTab = collections.htab.HTab;
19+
pub const HTabIter = collections.htab.HTabIter;
20+
pub const StringHashTable = collections.htab.StringHashTable;
21+
pub const KVHashTable = collections.htab.KVHashTable;
22+
1523
pub const elog = @import("pgzx/elog.zig");
24+
1625
pub const err = @import("pgzx/err.zig");
26+
pub const PGError = err.PGError;
27+
pub const pgRethrow = err.pgRethrow;
28+
1729
pub const fmgr = @import("pgzx/fmgr.zig");
30+
pub const PG_MODULE_MAGIC = fmgr.PG_MODULE_MAGIC;
31+
pub const PG_FUNCTION_V1 = fmgr.PG_FUNCTION_V1;
32+
pub const PG_FUNCTION_INFO_V1 = fmgr.PG_FUNCTION_INFO_V1;
33+
1834
pub const lwlock = @import("pgzx/lwlock.zig");
1935
pub const mem = @import("pgzx/mem.zig");
2036
pub const pq = @import("pgzx/pq.zig");
@@ -25,17 +41,4 @@ pub const utils = @import("pgzx/utils.zig");
2541
pub const intr = @import("pgzx/interrupts.zig");
2642
pub const testing = @import("pgzx/testing.zig");
2743

28-
// data structures
29-
pub const collections = @import("pgzx/collections.zig");
30-
3144
pub const guc = utils.guc;
32-
33-
pub const PGError = err.PGError;
34-
pub const pgRethrow = err.pgRethrow;
35-
36-
pub const PG_MODULE_MAGIC = fmgr.PG_MODULE_MAGIC;
37-
pub const PG_FUNCTION_V1 = fmgr.PG_FUNCTION_V1;
38-
pub const PG_FUNCTION_INFO_V1 = fmgr.PG_FUNCTION_INFO_V1;
39-
40-
pub const list = collections.list;
41-
pub const PointerListOf = list.PointerListOf;

src/pgzx/collections.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
pub const list = @import("collections/list.zig");
22
pub const slist = @import("collections/slist.zig");
33
pub const dlist = @import("collections/dlist.zig");
4+
pub const htab = @import("collections/htab.zig");

0 commit comments

Comments
 (0)