|
1 | 1 | const std = @import("std");
|
2 | 2 |
|
3 |
| -const c = @import("../c.zig"); |
4 |
| -const err = @import("../err.zig"); |
5 |
| -const mem = @import("../mem.zig"); |
6 |
| -const meta = @import("../meta.zig"); |
7 |
| -const varatt = @import("../varatt.zig"); |
| 3 | +const c = @import("c.zig"); |
| 4 | +const err = @import("err.zig"); |
| 5 | +const mem = @import("mem.zig"); |
| 6 | +const meta = @import("meta.zig"); |
| 7 | +const varatt = @import("varatt.zig"); |
8 | 8 |
|
9 | 9 | pub fn Conv(comptime T: type, comptime from: anytype, comptime to: anytype) type {
|
10 | 10 | return struct {
|
@@ -74,18 +74,18 @@ var directMappings = .{
|
74 | 74 | };
|
75 | 75 |
|
76 | 76 | pub fn fromNullableDatum(comptime T: type, d: c.NullableDatum) !T {
|
77 |
| - return find(T).fromNullableDatum(d); |
| 77 | + return findConv(T).fromNullableDatum(d); |
78 | 78 | }
|
79 | 79 |
|
80 | 80 | pub fn fromDatum(comptime T: type, d: c.Datum, is_null: bool) !T {
|
81 |
| - return find(T).fromNullableDatum(.{ .value = d, .isnull = is_null }); |
| 81 | + return findConv(T).fromNullableDatum(.{ .value = d, .isnull = is_null }); |
82 | 82 | }
|
83 | 83 |
|
84 | 84 | pub fn toNullableDatum(v: anytype) !c.NullableDatum {
|
85 |
| - return find(@TypeOf(v)).toNullableDatum(v); |
| 85 | + return findConv(@TypeOf(v)).toNullableDatum(v); |
86 | 86 | }
|
87 | 87 |
|
88 |
| -pub fn find(comptime T: type) type { |
| 88 | +pub fn findConv(comptime T: type) type { |
89 | 89 | if (isConv(T)) { // is T already a converter?
|
90 | 90 | return T;
|
91 | 91 | }
|
@@ -124,7 +124,7 @@ pub fn find(comptime T: type) type {
|
124 | 124 | 64 => Float64,
|
125 | 125 | else => @compileError("unsupported float type"),
|
126 | 126 | },
|
127 |
| - .Optional => |opt| OptConv(find(opt.child)), |
| 127 | + .Optional => |opt| OptConv(findConv(opt.child)), |
128 | 128 | .Array => @compileLog("fixed size arrays not supported"),
|
129 | 129 | .Pointer => blk: {
|
130 | 130 | if (!meta.isStringLike(T)) {
|
|
0 commit comments