Dont send link if not in AdditionalData

This commit is contained in:
Adrien Bouvais 2024-11-29 21:56:52 +01:00
parent 4ee79c9629
commit c6fe428270
2 changed files with 7 additions and 4 deletions

View File

@ -403,7 +403,7 @@ pub const FileEngine = struct {
// If there is no member to find, that mean we need to return all members, so let's populate additional data with all of them
if (additional_data.member_to_find.items.len == 0) {
additional_data.populateWithEverything(allocator, sstruct.members) catch return FileEngineError.MemoryError;
additional_data.populateWithEverythingExceptLink(allocator, sstruct.members, sstruct.types) catch return FileEngineError.MemoryError;
}
// Open the dir that contain all files
@ -479,7 +479,7 @@ pub const FileEngine = struct {
if (sync_context.checkStructLimit()) break;
if (filter) |f| if (!f.evaluate(row)) continue;
EntityWriter.writeEntityTable(
EntityWriter.writeEntityJSON(
writer,
row,
additional_data,

View File

@ -1,5 +1,7 @@
const std = @import("std");
const Allocator = std.mem.Allocator;
const dtype = @import("dtype");
const DataType = dtype.DataType;
/// This is the [] part
/// TODO: Include the part ".friends.comments" in "GRAB User.firends.comments {age > 10}"
@ -19,8 +21,9 @@ pub const AdditionalData = struct {
self.member_to_find.deinit();
}
pub fn populateWithEverything(self: *AdditionalData, allocator: Allocator, members: [][]const u8) !void {
for (members, 0..) |member, i| {
pub fn populateWithEverythingExceptLink(self: *AdditionalData, allocator: Allocator, members: [][]const u8, dtypes: []DataType) !void {
for (members, dtypes, 0..) |member, dt, i| {
if (dt == .link or dt == .link_array) continue;
try self.member_to_find.append(AdditionalDataMember.init(allocator, member, i));
}
}