[Groonga-commit] ranguba/groonga-client-model at 75c79b7 [master] Add methods used in tests

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Dec 5 18:15:31 JST 2016


Kouhei Sutou	2016-12-05 18:15:31 +0900 (Mon, 05 Dec 2016)

  New Revision: 75c79b750554bf0a7626079895ab0d2ad5f8b01e
  https://github.com/ranguba/groonga-client-model/commit/75c79b750554bf0a7626079895ab0d2ad5f8b01e

  Message:
    Add methods used in tests

  Modified files:
    lib/groonga_client_model/record.rb

  Modified: lib/groonga_client_model/record.rb (+14 -0)
===================================================================
--- lib/groonga_client_model/record.rb    2016-12-05 17:55:53 +0900 (e853172)
+++ lib/groonga_client_model/record.rb    2016-12-05 18:15:31 +0900 (1bf50c4)
@@ -45,6 +45,16 @@ module GroongaClientModel
         end
       end
 
+      def count
+        Client.open do |client|
+          table = schema.tables[table_name]
+          response = client.select(table: table.name,
+                                   limit: 0,
+                                   output_columns: ["_id"])
+          response.n_hits
+        end
+      end
+
       def all
         Client.open do |client|
           table = schema.tables[table_name]
@@ -74,6 +84,10 @@ module GroongaClientModel
         end
       end
 
+      def last
+        all.last
+      end
+
       private
       def define_method_attribute(name)
         define_method(name) do
-------------- next part --------------
HTML����������������������������...
Descargar 



More information about the Groonga-commit mailing list
Back to archive index