1 /* 2 Copyright(C) 2016 Brazil 3 Copyright(C) 2019 Kouhei Sutou <kou@clear-code.com> 4 5 This library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License version 2.1 as published by the Free Software Foundation. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with this library; if not, write to the Free Software 16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 module groonga_d.window_function; 19 20 21 private static import groonga_d.groonga; 22 23 extern(C): 24 nothrow @nogc: 25 26 enum grn_window_direction 27 { 28 GRN_WINDOW_DIRECTION_ASCENDING, 29 GRN_WINDOW_DIRECTION_DESCENDING, 30 } 31 32 extern struct _grn_window; 33 alias grn_window = _grn_window; 34 35 //GRN_API 36 uint grn_window_next(groonga_d.groonga.grn_ctx* ctx, grn_window* window); 37 38 //GRN_API 39 groonga_d.groonga.grn_rc grn_window_rewind(groonga_d.groonga.grn_ctx* ctx, grn_window* window); 40 41 //GRN_API 42 groonga_d.groonga.grn_rc grn_window_set_direction(groonga_d.groonga.grn_ctx* ctx, grn_window* window, grn_window_direction direction); 43 44 //GRN_API 45 groonga_d.groonga.grn_obj* grn_window_get_table(groonga_d.groonga.grn_ctx* ctx, grn_window* window); 46 47 //GRN_API 48 bool grn_window_is_context_table(groonga_d.groonga.grn_ctx* ctx, grn_window* window); 49 50 //GRN_API 51 groonga_d.groonga.grn_obj* grn_window_get_output_column(groonga_d.groonga.grn_ctx* ctx, grn_window* window); 52 53 //GRN_API 54 size_t grn_window_get_n_arguments(groonga_d.groonga.grn_ctx* ctx, grn_window* window); 55 56 //GRN_API 57 groonga_d.groonga.grn_obj* grn_window_get_argument(groonga_d.groonga.grn_ctx* ctx, grn_window* window, size_t i); 58 59 //GRN_API 60 bool grn_window_is_sorted(groonga_d.groonga.grn_ctx* ctx, grn_window* window); 61 62 63 //GRN_API 64 ubyte grn_window_is_sorted(groonga_d.groonga.grn_ctx* ctx, grn_window* window); 65 66 //GRN_API 67 size_t grn_window_get_size(groonga_d.groonga.grn_ctx* ctx, grn_window* window); 68 69 struct grn_window_definition 70 { 71 groonga_d.table.grn_table_sort_key* sort_keys; 72 size_t n_sort_keys; 73 groonga_d.table.grn_table_sort_key* group_keys; 74 size_t n_group_keys; 75 } 76 77 alias _grn_window_definition = grn_window_definition; 78 79 //typedef groonga_d.groonga.grn_rc grn_window_function_func(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* first_output_column, grn_window* window, groonga_d.groonga.grn_obj** first_args, int first_n_args); 80 alias grn_window_function_func = extern (C) nothrow @nogc groonga_d.groonga.grn_rc function(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* first_output_column, grn_window* window, groonga_d.groonga.grn_obj** first_args, int first_n_args); 81 82 //GRN_API 83 groonga_d.groonga.grn_obj* grn_window_function_create(groonga_d.groonga.grn_ctx* ctx, const (char)* name, int name_size, grn_window_function_func func); 84 85 /* Deprecated since 9.0.2. 86 Use grn_window_function_executor() instead. */ 87 //GRN_API 88 deprecated 89 groonga_d.groonga.grn_rc grn_table_apply_window_function(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* table, groonga_d.groonga.grn_obj* output_column, grn_window_definition* definition, groonga_d.groonga.grn_obj* window_function_call);