Navigation Menu

Skip to content

Commit

Permalink
object_inspect: show column flags
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Apr 6, 2017
1 parent 8f6a5e9 commit c87621f
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 12 deletions.
26 changes: 18 additions & 8 deletions lib/proc/proc_object_inspect.c
Expand Up @@ -241,22 +241,32 @@ command_object_inspect_column_value(grn_ctx *ctx, grn_obj *column)
}

static void
command_object_inspect_column(grn_ctx *ctx, grn_obj *obj)
command_object_inspect_column(grn_ctx *ctx, grn_obj *column)
{
grn_ctx_output_map_open(ctx, "column", 5);
grn_ctx_output_map_open(ctx, "column", 9);
{
grn_column_flags column_flags;

column_flags = grn_column_get_flags(ctx, column);

grn_ctx_output_cstr(ctx, "id");
grn_ctx_output_uint64(ctx, grn_obj_id(ctx, obj));
grn_ctx_output_uint64(ctx, grn_obj_id(ctx, column));
grn_ctx_output_cstr(ctx, "name");
command_object_inspect_column_name(ctx, obj);
command_object_inspect_column_name(ctx, column);
grn_ctx_output_cstr(ctx, "table");
command_object_inspect_table(ctx, grn_ctx_at(ctx, obj->header.domain));
command_object_inspect_table(ctx, grn_ctx_at(ctx, column->header.domain));
grn_ctx_output_cstr(ctx, "full_name");
command_object_inspect_obj_name(ctx, obj);
command_object_inspect_obj_name(ctx, column);
grn_ctx_output_cstr(ctx, "type");
command_object_inspect_column_type(ctx, obj);
command_object_inspect_column_type(ctx, column);
grn_ctx_output_cstr(ctx, "value");
command_object_inspect_column_value(ctx, obj);
command_object_inspect_column_value(ctx, column);
grn_ctx_output_cstr(ctx, "section");
grn_ctx_output_bool(ctx, (column_flags & GRN_OBJ_WITH_SECTION) != 0);
grn_ctx_output_cstr(ctx, "weight");
grn_ctx_output_bool(ctx, (column_flags & GRN_OBJ_WITH_WEIGHT) != 0);
grn_ctx_output_cstr(ctx, "position");
grn_ctx_output_bool(ctx, (column_flags & GRN_OBJ_WITH_POSITION) != 0);
}
grn_ctx_output_map_close(ctx);
}
Expand Down
5 changes: 4 additions & 1 deletion test/command/suite/object_inspect/column/index.expected
Expand Up @@ -61,6 +61,9 @@ object_inspect Terms.memos_title_content
},
"size": 4
}
}
},
"section": true,
"weight": false,
"position": true
}
]
5 changes: 4 additions & 1 deletion test/command/suite/object_inspect/column/scalar_fix.expected
Expand Up @@ -55,6 +55,9 @@ object_inspect Users.age
},
"size": 1
}
}
},
"section": false,
"weight": false,
"position": false
}
]
5 changes: 4 additions & 1 deletion test/command/suite/object_inspect/column/scalar_var.expected
Expand Up @@ -43,6 +43,9 @@ object_inspect Memos.title
},
"size": 4096
}
}
},
"section": false,
"weight": false,
"position": false
}
]
5 changes: 4 additions & 1 deletion test/command/suite/object_inspect/column/vector.expected
Expand Up @@ -43,6 +43,9 @@ object_inspect Memos.tags
},
"size": 4096
}
}
},
"section": false,
"weight": false,
"position": false
}
]

0 comments on commit c87621f

Please sign in to comment.