Skip to content

Commit

Permalink
export meta
Browse files Browse the repository at this point in the history
  • Loading branch information
urso authored and urso committed Mar 18, 2024
1 parent 51d84a6 commit f21bb98
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pgzx.zig
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,8 @@ pub const utils = @import("pgzx/utils.zig");
pub const intr = @import("pgzx/interrupts.zig");
pub const testing = @import("pgzx/testing.zig");

// reexport the meta module. Although quite generic, it is useful to have these
// helpers around at times.
pub const meta = @import("pgzx/meta.zig");

pub const guc = utils.guc;
7 changes: 7 additions & 0 deletions src/pgzx/meta.zig
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@ pub inline fn isPrimitive(comptime T: type) bool {
else => false,
};
}

pub inline fn fnReturnType(comptime T: type, comptime fnName: []const u8) type {
return switch (@typeInfo(@field(T, fnName))) {
.Fn => |f| f.return_type.?,
else => @compileError("Expected a function type"),
};
}

0 comments on commit f21bb98

Please sign in to comment.