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 private static import groonga_d.table; 23 24 extern(C): 25 nothrow @nogc: 26 27 enum grn_window_direction 28 { 29 GRN_WINDOW_DIRECTION_ASCENDING, 30 GRN_WINDOW_DIRECTION_DESCENDING, 31 } 32 33 //Declaration name in C language 34 enum 35 { 36 GRN_WINDOW_DIRECTION_ASCENDING = .grn_window_direction.GRN_WINDOW_DIRECTION_ASCENDING, 37 GRN_WINDOW_DIRECTION_DESCENDING = .grn_window_direction.GRN_WINDOW_DIRECTION_DESCENDING, 38 } 39 40 extern struct _grn_window; 41 alias grn_window = _grn_window; 42 43 //GRN_API 44 groonga_d.groonga.grn_id grn_window_next(groonga_d.groonga.grn_ctx* ctx, grn_window* window); 45 46 //GRN_API 47 groonga_d.groonga.grn_rc grn_window_rewind(groonga_d.groonga.grn_ctx* ctx, grn_window* window); 48 49 //GRN_API 50 groonga_d.groonga.grn_rc grn_window_set_direction(groonga_d.groonga.grn_ctx* ctx, grn_window* window, grn_window_direction direction); 51 52 //GRN_API 53 groonga_d.groonga.grn_obj* grn_window_get_table(groonga_d.groonga.grn_ctx* ctx, grn_window* window); 54 55 //GRN_API 56 bool grn_window_is_context_table(groonga_d.groonga.grn_ctx* ctx, grn_window* window); 57 58 //GRN_API 59 groonga_d.groonga.grn_obj* grn_window_get_output_column(groonga_d.groonga.grn_ctx* ctx, grn_window* window); 60 61 //GRN_API 62 size_t grn_window_get_n_arguments(groonga_d.groonga.grn_ctx* ctx, grn_window* window); 63 64 //GRN_API 65 groonga_d.groonga.grn_obj* grn_window_get_argument(groonga_d.groonga.grn_ctx* ctx, grn_window* window, size_t i); 66 67 //GRN_API 68 bool grn_window_is_sorted(groonga_d.groonga.grn_ctx* ctx, grn_window* window); 69 70 71 //GRN_API 72 ubyte grn_window_is_sorted(groonga_d.groonga.grn_ctx* ctx, grn_window* window); 73 74 //GRN_API 75 size_t grn_window_get_size(groonga_d.groonga.grn_ctx* ctx, grn_window* window); 76 77 struct _grn_window_definition 78 { 79 groonga_d.table.grn_table_sort_key* sort_keys; 80 size_t n_sort_keys; 81 groonga_d.table.grn_table_sort_key* group_keys; 82 size_t n_group_keys; 83 } 84 85 alias grn_window_definition = ._grn_window_definition; 86 87 //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); 88 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); 89 90 //GRN_API 91 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); 92 93 /* Deprecated since 9.0.2. 94 Use grn_window_function_executor() instead. */ 95 //GRN_API 96 deprecated 97 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);