groonga-client-model 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +5 -0
- data/Gemfile +23 -0
- data/README.md +38 -0
- data/Rakefile +46 -0
- data/doc/text/lgpl-2.1.txt +502 -0
- data/doc/text/news.md +5 -0
- data/groonga-client-model.gemspec +55 -0
- data/lib/groonga-client-model.rb +40 -0
- data/lib/groonga_client_model/client.rb +37 -0
- data/lib/groonga_client_model/client_opener.rb +24 -0
- data/lib/groonga_client_model/error.rb +46 -0
- data/lib/groonga_client_model/load_value_generator.rb +54 -0
- data/lib/groonga_client_model/modelizable.rb +26 -0
- data/lib/groonga_client_model/modelize.rb +83 -0
- data/lib/groonga_client_model/railtie.rb +62 -0
- data/lib/groonga_client_model/record.rb +324 -0
- data/lib/groonga_client_model/schema.rb +109 -0
- data/lib/groonga_client_model/spec_helper.rb +27 -0
- data/lib/groonga_client_model/test_helper.rb +27 -0
- data/lib/groonga_client_model/version.rb +19 -0
- data/test/apps/rails5/Gemfile +50 -0
- data/test/apps/rails5/Gemfile.lock +208 -0
- data/test/apps/rails5/README.md +24 -0
- data/test/apps/rails5/Rakefile +6 -0
- data/test/apps/rails5/app/assets/config/manifest.js +3 -0
- data/test/apps/rails5/app/assets/javascripts/application.js +16 -0
- data/test/apps/rails5/app/assets/javascripts/cable.js +13 -0
- data/test/apps/rails5/app/assets/javascripts/posts.coffee +3 -0
- data/test/apps/rails5/app/assets/stylesheets/application.css +15 -0
- data/test/apps/rails5/app/assets/stylesheets/posts.scss +3 -0
- data/test/apps/rails5/app/assets/stylesheets/scaffolds.scss +89 -0
- data/test/apps/rails5/app/channels/application_cable/channel.rb +4 -0
- data/test/apps/rails5/app/channels/application_cable/connection.rb +4 -0
- data/test/apps/rails5/app/controllers/application_controller.rb +3 -0
- data/test/apps/rails5/app/controllers/posts_controller.rb +74 -0
- data/test/apps/rails5/app/helpers/application_helper.rb +2 -0
- data/test/apps/rails5/app/helpers/posts_helper.rb +2 -0
- data/test/apps/rails5/app/jobs/application_job.rb +2 -0
- data/test/apps/rails5/app/mailers/application_mailer.rb +4 -0
- data/test/apps/rails5/app/models/post.rb +2 -0
- data/test/apps/rails5/app/views/layouts/application.html.erb +14 -0
- data/test/apps/rails5/app/views/layouts/mailer.html.erb +13 -0
- data/test/apps/rails5/app/views/layouts/mailer.text.erb +1 -0
- data/test/apps/rails5/app/views/posts/_form.html.erb +27 -0
- data/test/apps/rails5/app/views/posts/_post.json.jbuilder +2 -0
- data/test/apps/rails5/app/views/posts/edit.html.erb +6 -0
- data/test/apps/rails5/app/views/posts/index.html.erb +29 -0
- data/test/apps/rails5/app/views/posts/index.json.jbuilder +1 -0
- data/test/apps/rails5/app/views/posts/new.html.erb +5 -0
- data/test/apps/rails5/app/views/posts/show.html.erb +14 -0
- data/test/apps/rails5/app/views/posts/show.json.jbuilder +1 -0
- data/test/apps/rails5/bin/bundle +3 -0
- data/test/apps/rails5/bin/rails +9 -0
- data/test/apps/rails5/bin/rake +9 -0
- data/test/apps/rails5/bin/setup +34 -0
- data/test/apps/rails5/bin/spring +16 -0
- data/test/apps/rails5/bin/update +29 -0
- data/test/apps/rails5/config.ru +5 -0
- data/test/apps/rails5/config/application.rb +25 -0
- data/test/apps/rails5/config/boot.rb +3 -0
- data/test/apps/rails5/config/cable.yml +9 -0
- data/test/apps/rails5/config/environment.rb +5 -0
- data/test/apps/rails5/config/environments/development.rb +51 -0
- data/test/apps/rails5/config/environments/production.rb +83 -0
- data/test/apps/rails5/config/environments/test.rb +42 -0
- data/test/apps/rails5/config/groonga.yml +8 -0
- data/test/apps/rails5/config/initializers/application_controller_renderer.rb +6 -0
- data/test/apps/rails5/config/initializers/assets.rb +11 -0
- data/test/apps/rails5/config/initializers/backtrace_silencers.rb +7 -0
- data/test/apps/rails5/config/initializers/cookies_serializer.rb +5 -0
- data/test/apps/rails5/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/apps/rails5/config/initializers/inflections.rb +16 -0
- data/test/apps/rails5/config/initializers/mime_types.rb +4 -0
- data/test/apps/rails5/config/initializers/new_framework_defaults.rb +21 -0
- data/test/apps/rails5/config/initializers/session_store.rb +3 -0
- data/test/apps/rails5/config/initializers/wrap_parameters.rb +9 -0
- data/test/apps/rails5/config/locales/en.yml +23 -0
- data/test/apps/rails5/config/puma.rb +47 -0
- data/test/apps/rails5/config/routes.rb +4 -0
- data/test/apps/rails5/config/secrets.yml +22 -0
- data/test/apps/rails5/config/spring.rb +6 -0
- data/test/apps/rails5/db/schema.grn +9 -0
- data/test/apps/rails5/db/seeds.rb +7 -0
- data/test/apps/rails5/log/development.log +348 -0
- data/test/apps/rails5/log/test.log +1824 -0
- data/test/apps/rails5/public/404.html +67 -0
- data/test/apps/rails5/public/422.html +67 -0
- data/test/apps/rails5/public/500.html +66 -0
- data/test/apps/rails5/public/apple-touch-icon-precomposed.png +0 -0
- data/test/apps/rails5/public/apple-touch-icon.png +0 -0
- data/test/apps/rails5/public/favicon.ico +0 -0
- data/test/apps/rails5/public/robots.txt +5 -0
- data/test/apps/rails5/test/controllers/posts_controller_test.rb +50 -0
- data/test/apps/rails5/test/factories/posts.rb +6 -0
- data/test/apps/rails5/test/test_helper.rb +9 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/-8/-8MPXp-nRdAuudlPZG0-fjIhSfT9c-mruIMNR_HnpTE.cache +2 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/04/04zh1ytKDagWzWcqUyadXtzzohCn9iVvSVG4KrjpfPU.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/0M/0M4bZ4tQh0MQYZMb72U5yr-ELStAsUSb8akkTME9TPM.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/0g/0gB1rYz79RuAa43DzVci1GUjc5so0F1dU_LyLSmm3oQ.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/1w/1w3lEnPL9oZPD-uk9Y9HOAO5TBywbDUumPsLKAD1trs.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/2g/2gve43APDqh4mVsNSvvDZWU7XBUFJ22DjchDFC7BLHE.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/3F/3Fsw9a9YyB3-WaDSpA1HTGJrWn_7xMLLpUYcNv4f4zs.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/3P/3Px3lDIUtsiFfGy4nQGown3yldwKCp1MNuWbSDX1pvg.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/46/46uDYcwHwTAfdjT4Cxqs7pC3FEBf4GNj8S36-TDtT18.cache +2 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/5g/5gcXfyU_2YGZzzLIX2HgVkpwSaUUyIH9beyVvR4-RyM.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/6a/6ae9A4LxsOF8WxXqTRrY_OfmiKLzuX-k8CdxcYhyH2w.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/6g/6gfb-nNauXmim2itNUscPWKLGmjzBgnE4ee76bNftS4.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/71/71Km0xL27urBNH3LVGVQ7MXXtuIePWU9VsJ4VjSeMac.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/8Z/8Zm1d9-lBPsGG_HUw8FP2OCCVucGDVhWAOGaopvOdss.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/8w/8wTyiibSVQ_CunXEyCjFUbzdSEAuSbH0z5XuCUXG0EA.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/9p/9pkKAqd_Ia0HpbbUCZtpJ8WiDzr5stcFJsnqsOsJwCc.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/B9/B9QeeLv4GR9sOdrwyvxa8jIr4MkxjYh4Ow6MOZ8slX8.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/BK/BKtHbqHUW-BUh6yXbZoSBLGYZdH4xpyEVJZ85mre3dI.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Bx/BxzoG0KxeNLac4xTNeJv3qfeytbNBw58xj2zD-xdbrE.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/DG/DGB9_ZZc6xf8xDs1C8MTwsnZGITqTg5w6Fi8loIoAz0.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/DI/DIQbAB3xoMpwIuVisoyQuLOOLReZGqTzMsMSqPTvNlU.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Dc/Dcujr9N54L76juPEo4EOYs8buHy8vO2fp-AjoG42-uQ.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Dw/DwMpASR_zMhZCB0WD5ibeEaOAEhod-gPDA-cl83A0NQ.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/F2/F2G2wQz7oPKX0Y4KCAUyw79ULHKyiweLkqbo4uclz2M.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/F4/F4Vm2jVryhME1Ux-h1fCIbynttYJmSOV0lzVQihiIas.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/G0/G0kukI-r0q0Vbrg6e_jnYJoYcOX8K__h-mwKbCf4twE.cache +2 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/H4/H4qMae4wP-2E0IT3OzIKJm7TAmkfgTg5GG-mDvrpRr8.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/HJ/HJmxnxAVu4ESMb2RUFATQhzd8xP7qwk0i7Or2WU6tHY.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Ih/IhFDQr9KaIbw7KJmoi9sRJ2CWZtxt72J0Eu2HDAQYJA.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/J-/J-hbdFdKmhYgVvczTzQyQ6ToGIL2Ucw2qCT6Y1oOPhg.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/KZ/KZDZMIUD9LD98z__9bjCHLnzjcGoKSnlxuHH1cEiw6M.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/LD/LDzW9KshYb0NgRzu1HyrKQlc3satBlIIOEHET_I4TjA.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Mw/MwUXpv2ArJcHhHfRN-i_SHhOyrhE2ED5DP6j2_tHtDM.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/N6/N6_UDcd-9vm063oO9Kj2UKERXHyG53mpljIHhMP_sX0.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Ot/OttEu6oltiTErpVGZQJA3vWOb24u3_w28yMEG-Gs0tA.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/P1/P1Ojlz0OChhbxGf83KhMWxJFzKZ3unhLwJ1UoH5U7ss.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Pz/PzsjxNnBT0RlIX-T49i6Iyrc_XG8IaJ-F55_x52md8M.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Q0/Q0AeQIZuDbFTvWKLlSaL-R4XKHuiymwgVvQUqxxVq_k.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Qr/Qrr38H1OZvkfozoMfcDEQ-arpbO7PFQ47i70UTEeWnk.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Qw/QwtseSptjk29vLQAs9XVSY_9GY6mR4wLQ6e3xJZzwuo.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Rf/RfAETGxupO0E6Sf50S9Rs_7H_8IFQkZ0V_Ot0qRcMaM.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/S1/S1RgRu3SVlB0u9krRyLUpNzVgKMN9Pk_KMWLehP2SUc.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/SN/SNLpl8dBME7slRhucvmV_kjMQImk-VGiILaga5lEcBM.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/SO/SOU1TEHFYRVejiA6nBNRm3Bwq_YtPlxSXK0VM3y3vto.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Sd/Sda0ZUElAQoD0SXBgNqF99THI2KdVA4YOcdhAyZxPsY.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Sh/ShN-ZUpoxLJLJiMV5gFDP00vcSMHw87YzFBlXH4adPA.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Si/Sin6bEoASrNa45108CpfgF2jcifz-KpbsvvZJtqVZ68.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/TI/TIt8bfq26rstydJvFM28p05FfB6s8Qjr6EoF6EtQUEc.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Uk/UkodNPk80caeUqn1HNQXMB1qV-c-4l-vBFHb7fd5ZGw.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Uw/Uws4qYyGLobvE_JD4L6dQNcIOOhv4LEZ3D0mK86tZOA.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Wm/WmtvDDxglSnhmavMeA7WNn7waN3QbagRHeoZHvZJN84.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/X6/X6u2Cul1j8SpBq0WC1S8WhzGiT6f-6L_djUngh_gQfw.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Xe/XeuTfsFtikyfcpzyNjJW7GvVARtV7EFUF8V9lJuS9zs.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Ya/YayMISAqD-Y3vBFywwKrXbUovGf5o77HUF5s8mnQgO0.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Z2/Z2fYOjvDRsoVXYUWY_QLV3gqU-HobuEZ7vKRjuJO-80.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Zj/ZjPZKMxS8BzA1QxHFURXSpprFItP8iIYNCg6yfbO69Y.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/a7/a7_aLHXKzPVK1lGdqvWuCl5hXxwSIGH4kcxuF7jMzgE.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/c9/c9YydpmE9rI8VeQ4sVqd5JrA1VSEFGGzpuMBUSrAGac.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/cB/cBjyp28toLdtY2EFK9cqrbDnrwBSFI7T_vLNoGz-u_U.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/cT/cT8i2C4yg0R2UYvutxD-4kbdJF09toG1OUgtd6NAf2M.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/cU/cUegCc5wz5f7rfqzD7wrbN633pZRWeewi9j1lJ895Y0.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/dA/dAab_MVPXubReIXiKSsP0TGA9dXca0KkwVLz7xNJNmA.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/eY/eYUlaSCg8w9Jp-IVGbffopOhH4C94vGA0w6SaC88FM8.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/eo/eoSb6VtmOhc2zv4rO1yMBf6hjUj7zHVkSMiNZ7Y576w.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/gm/gmeq3PfpFbfe2L0ijWzw1Dzny6T-kD3zREQjh6XGs-o.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/he/heptoj4xFW23bqbGAnQ2g6MsS3OKgswQZOu4EFQA9CE.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/kN/kNQUVmgZpBoZh9oC57J3qRmnvFOb8zfDeJWar6cPJFM.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/km/km1UJe7Uvz3cE03ctzec3Mpcow_vgKO36rq50_Szy3o.cache +5 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/kv/kvOgs1tp83VikXcBjupUg71ybkDcx1pBzH2Dw6mVa7A.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/kz/kzw210ITXFWNFV8kw5e-_kRlpS48lGotSQWKPlUfMJ4.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/m-/m-gDByrlve8T_OZCCZCaGVlLUnbGWk0qkv7naFMcLDg.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/m8/m8XSfEV5J53MzAtMK6udqOZh9S_uC-tELG327hLnWT4.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/n_/n_xYqQYhwEMQknb3jFQnjlxxBE9TzMNHCdJ-bEyZFIw.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/na/naKBB6bJXEjSAfrBfAiXlIzJDRGTsRrbQlI5FezRxnM.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/nx/nxTv3sKVUQZADJyM3dPaVmUA78MIsMLD_K279yN_GsI.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/oU/oUgVYeNUmvSbf5MWq5a-nknLIlepM8oMGSWyD1J5bzg.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/pN/pNBMBzHv-_a5u4lbxQmRsv_hzWZOk93wX3hlG4y4X5E.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/pb/pb0V-IHbOTzmTuDDHO7dn8kl3G4RWqXYY1-Gtuklh-M.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/pq/pqi4pYpSRroaGdwCXuATmVeb1U-mvzUU8zeWu6o5ooo.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/q9/q9zC8RrLhOO1dVXJ3fZqc9dSbshhjSpsDQxh5MpbnDA.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/qP/qPmv5snMrDw830S6hSICDcnIy7kVEWoFKXhGKT38lG4.cache +2 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/rn/rnjUJtM3qyEybb7S3NaVbV36OvY6ulGzqxgvp6vtkW0.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/rv/rvA5ImExxmMtvHSKmwVMXxnVzM4istECfBR-LxbUf8I.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/sS/sSg6UsW5PPi591GTK35btFew1r3_HpbNHoyZv3vZ_HY.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/t3/t39F_1zIFMdWiKVUNJyhWOOnP8Lgr6AD5R1HWdVYwbU.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/tV/tVL6qud2OxyiMT_-izeWpZa4KnypOUhK0XjwBIPVgi0.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/uo/uo2nRPLQSA3FmFVLvE-9uXW64Xx-Gp799qSF3vui1WE.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/x7/x7PYh8DJvPykcEqpVab2vcY9-GFz-3cqtoMlRAu94Uc.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/xU/xUR-yFcc0UZR2BLp-jBU9bjPiIYophx6ep5yBEeQCM8.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/zh/zhmfmdnnow0QqwfT_7IXfN-FAU8qAMm03N7XQjFct6E.cache +1 -0
- data/test/apps/rails5/tmp/restart.txt +0 -0
- data/test/run-test.rb +49 -0
- data/test/unit/run-test.rb +35 -0
- data/test/unit/test_load_value_generator.rb +79 -0
- data/test/unit/test_record.rb +52 -0
- metadata +516 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
|
2
|
+
#
|
|
3
|
+
# This library is free software; you can redistribute it and/or
|
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
5
|
+
# License as published by the Free Software Foundation; either
|
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
11
|
+
# Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
14
|
+
# License along with this library; if not, write to the Free Software
|
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16
|
+
|
|
17
|
+
module GroongaClientModel
|
|
18
|
+
class Record
|
|
19
|
+
include ActiveModel::AttributeAssignment
|
|
20
|
+
include ActiveModel::AttributeMethods
|
|
21
|
+
include ActiveModel::Callbacks
|
|
22
|
+
include ActiveModel::Conversion
|
|
23
|
+
include ActiveModel::Dirty
|
|
24
|
+
include ActiveModel::Translation
|
|
25
|
+
include ActiveModel::Validations
|
|
26
|
+
|
|
27
|
+
class << self
|
|
28
|
+
def i18n_scope
|
|
29
|
+
:groonga_client_model
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def schema
|
|
33
|
+
@@schema ||= Schema.new
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def table_name
|
|
37
|
+
name.to_s.demodulize.underscore.pluralize
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def columns
|
|
41
|
+
schema.tables[table_name].columns
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def define_attributes
|
|
45
|
+
return if defined?(@defined)
|
|
46
|
+
@defined = true
|
|
47
|
+
attribute_method_suffix("=")
|
|
48
|
+
define_attribute_methods(*columns.names)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def count
|
|
52
|
+
select.limit(0).output_columns("_id").response.n_hits
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def all
|
|
56
|
+
select.limit(-1)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def find(id)
|
|
60
|
+
record = select.filter("_id == %{id}", id: id).limit(1).first
|
|
61
|
+
if record.nil?
|
|
62
|
+
raise RecordNotFound.new("Record not found: _id: <#{id}>")
|
|
63
|
+
end
|
|
64
|
+
record
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def first
|
|
68
|
+
select.sort_keys("_id").limit(1).first
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def last
|
|
72
|
+
select.sort_keys("-_id").limit(1).first
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def select
|
|
76
|
+
full_text_searchable_column_names = []
|
|
77
|
+
columns.each do |name, column|
|
|
78
|
+
if column.have_full_text_search_index?
|
|
79
|
+
full_text_searchable_column_names << name
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
model_class = self
|
|
83
|
+
model_class_module = Module.new do
|
|
84
|
+
define_method :model_class do
|
|
85
|
+
model_class
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
extensions = [
|
|
89
|
+
ClientOpener,
|
|
90
|
+
Modelizable,
|
|
91
|
+
model_class_module,
|
|
92
|
+
]
|
|
93
|
+
Groonga::Client::Request::Select.new(table_name, extensions).
|
|
94
|
+
match_columns(full_text_searchable_column_names)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
private
|
|
98
|
+
def define_method_attribute(name)
|
|
99
|
+
define_method(name) do
|
|
100
|
+
@attributes[name]
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def define_method_attribute=(name)
|
|
105
|
+
define_method("#{name}=") do |value|
|
|
106
|
+
if value.is_a?(Hash)
|
|
107
|
+
value = build_sub_record(name, value)
|
|
108
|
+
end
|
|
109
|
+
unless @attributes[name] == value
|
|
110
|
+
attribute_will_change!(name)
|
|
111
|
+
end
|
|
112
|
+
@attributes[name] = value
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
define_model_callbacks :save, :create, :update, :destroy
|
|
118
|
+
|
|
119
|
+
attr_reader :attributes
|
|
120
|
+
|
|
121
|
+
def initialize(attributes=nil)
|
|
122
|
+
@attributes = {}
|
|
123
|
+
self.class.define_attributes
|
|
124
|
+
assign_attributes(attributes) if attributes
|
|
125
|
+
|
|
126
|
+
if @attributes["_id"]
|
|
127
|
+
@new_record = false
|
|
128
|
+
clear_changes_information
|
|
129
|
+
else
|
|
130
|
+
@new_record = true
|
|
131
|
+
end
|
|
132
|
+
@destroyed = false
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def save(validate: false)
|
|
136
|
+
run_callbacks(:save) do
|
|
137
|
+
save_raw(validate: validate)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def save!(validate: false)
|
|
142
|
+
unless save(validate: validate)
|
|
143
|
+
message = "Failed to save the record"
|
|
144
|
+
raise RecordNotSaved.new(message, self)
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def destroy
|
|
149
|
+
run_callbacks(:destroy) do
|
|
150
|
+
destroy_raw
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def update(attributes)
|
|
155
|
+
assign_attributes(attributes)
|
|
156
|
+
save
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def id
|
|
160
|
+
_id
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def new_record?
|
|
164
|
+
@new_record
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def destroyed?
|
|
168
|
+
@destroyed
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def persisted?
|
|
172
|
+
return false if @new_record
|
|
173
|
+
return false if @destroyed
|
|
174
|
+
true
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def assign_dynamic_attributes(dynamic_attributes)
|
|
178
|
+
return if dynamic_attributes.blank?
|
|
179
|
+
|
|
180
|
+
dynamic_attributes.each do |name, value|
|
|
181
|
+
assign_dynamic_attribute(name, value)
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def assign_dynamic_attribute(name, value)
|
|
186
|
+
if respond_to?(name)
|
|
187
|
+
singleton_class.__send__(:undef_method, name)
|
|
188
|
+
end
|
|
189
|
+
singleton_class.__send__(:define_method, name) do
|
|
190
|
+
value
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
private
|
|
195
|
+
def save_raw(validate:)
|
|
196
|
+
if validate
|
|
197
|
+
if valid?
|
|
198
|
+
upsert
|
|
199
|
+
else
|
|
200
|
+
false
|
|
201
|
+
end
|
|
202
|
+
else
|
|
203
|
+
upsert
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
def destroy_raw
|
|
208
|
+
if persisted?
|
|
209
|
+
Client.open do |client|
|
|
210
|
+
table = self.class.schema.tables[self.class.table_name]
|
|
211
|
+
response = client.delete(table: table.name,
|
|
212
|
+
filter: "_id == #{_id}")
|
|
213
|
+
unless response.success?
|
|
214
|
+
message = "Failed to delete the record: "
|
|
215
|
+
message << "#{response.return_code}: #{response.error_message}"
|
|
216
|
+
raise Error.new(message, self)
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
@destroyed = true
|
|
221
|
+
freeze
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
def upsert
|
|
225
|
+
if new_record?
|
|
226
|
+
run_callbacks(:create) do
|
|
227
|
+
upsert_raw
|
|
228
|
+
end
|
|
229
|
+
else
|
|
230
|
+
run_callbacks(:update) do
|
|
231
|
+
upsert_raw
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
def upsert_raw
|
|
237
|
+
upsert_sub_records
|
|
238
|
+
Client.open do |client|
|
|
239
|
+
table = self.class.schema.tables[self.class.table_name]
|
|
240
|
+
load_value_generator = LoadValueGenerator.new(self)
|
|
241
|
+
value = load_value_generator.generate
|
|
242
|
+
response = client.load(table: table.name,
|
|
243
|
+
values: [value],
|
|
244
|
+
output_ids: "yes",
|
|
245
|
+
command_version: "3")
|
|
246
|
+
unless response.success?
|
|
247
|
+
message = "Failed to save: "
|
|
248
|
+
message << "#{response.return_code}: #{response.error_message}"
|
|
249
|
+
raise RecordNotSaved.new(message, self)
|
|
250
|
+
end
|
|
251
|
+
if response.n_loaded_records.zero?
|
|
252
|
+
message = "Failed to save: #{value.inspect}"
|
|
253
|
+
raise RecordNotSaved.new(message, self)
|
|
254
|
+
end
|
|
255
|
+
if @new_record
|
|
256
|
+
id = response.loaded_ids.first
|
|
257
|
+
if id.nil?
|
|
258
|
+
select_request = self.class.select.limit(1).output_columns("_id")
|
|
259
|
+
if @attributes.key?("_key")
|
|
260
|
+
select_request = select_request.filter("_key == %{key}",
|
|
261
|
+
key: _key)
|
|
262
|
+
else
|
|
263
|
+
# TODO: may return not newly added record
|
|
264
|
+
select_request = select_request.sort_keys("-_id")
|
|
265
|
+
end
|
|
266
|
+
id = select_request.first._id
|
|
267
|
+
end
|
|
268
|
+
self._id = id
|
|
269
|
+
end
|
|
270
|
+
@new_record = false
|
|
271
|
+
changes_applied
|
|
272
|
+
true
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
def upsert_sub_records
|
|
277
|
+
attributes.each do |name, value|
|
|
278
|
+
upsert_sub_record(value)
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
def upsert_sub_record(sub_record)
|
|
283
|
+
case sub_record
|
|
284
|
+
when Record
|
|
285
|
+
sub_record.save if sub_record.changed?
|
|
286
|
+
when Array
|
|
287
|
+
sub_record.each do |sub_element|
|
|
288
|
+
upsert_sub_record(sub_element)
|
|
289
|
+
end
|
|
290
|
+
end
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
def build_sub_record(name, value)
|
|
294
|
+
column = self.class.columns[name]
|
|
295
|
+
return value unless column
|
|
296
|
+
|
|
297
|
+
return value unless column.value_type.type == "reference"
|
|
298
|
+
|
|
299
|
+
class_name = name.classify
|
|
300
|
+
begin
|
|
301
|
+
sub_record_class = class_name.constantize
|
|
302
|
+
rescue NameError
|
|
303
|
+
return value
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
is_vector = (column.type == "vector")
|
|
307
|
+
if is_vector
|
|
308
|
+
sub_record_values = []
|
|
309
|
+
value.each do |sub_name, sub_values|
|
|
310
|
+
sub_values.each_with_index do |sub_value, i|
|
|
311
|
+
sub_record_value = (sub_record_values[i] ||= {})
|
|
312
|
+
sub_record_value[sub_name] = sub_value
|
|
313
|
+
end
|
|
314
|
+
end
|
|
315
|
+
sub_record_values.collect do |sub_record_value|
|
|
316
|
+
sub_record_class.new(sub_record_value)
|
|
317
|
+
end
|
|
318
|
+
else
|
|
319
|
+
return nil if value["_key"].blank?
|
|
320
|
+
sub_record_class.new(value)
|
|
321
|
+
end
|
|
322
|
+
end
|
|
323
|
+
end
|
|
324
|
+
end
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
|
2
|
+
#
|
|
3
|
+
# This library is free software; you can redistribute it and/or
|
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
5
|
+
# License as published by the Free Software Foundation; either
|
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
11
|
+
# Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
14
|
+
# License along with this library; if not, write to the Free Software
|
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16
|
+
|
|
17
|
+
module GroongaClientModel
|
|
18
|
+
class Schema
|
|
19
|
+
def initialize
|
|
20
|
+
@raw = GroongaClientModel::Client.open do |client|
|
|
21
|
+
response = client.schema
|
|
22
|
+
unless response.success?
|
|
23
|
+
message = "failed to retrieve schema: "
|
|
24
|
+
message << "#{response.return_code}:#{response.error_message}"
|
|
25
|
+
raise Error, message
|
|
26
|
+
end
|
|
27
|
+
response
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def tables
|
|
32
|
+
Tables.new(@raw, @raw.tables)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class Tables
|
|
36
|
+
def initialize(raw_schema, raw_tables)
|
|
37
|
+
@raw_schema = raw_schema
|
|
38
|
+
@raw_tables = raw_tables
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def [](name)
|
|
42
|
+
name = name.to_s if name.is_a?(Symbol)
|
|
43
|
+
raw_table = @raw_tables[name]
|
|
44
|
+
raise Error, "table doesn't exist: <#{name.inspect}>" if raw_table.nil?
|
|
45
|
+
Table.new(@raw_schema, raw_table)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def exist?(name)
|
|
49
|
+
@raw_tables.key?(name)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
class Table
|
|
54
|
+
def initialize(raw_schema, raw_table)
|
|
55
|
+
@raw_schema = raw_schema
|
|
56
|
+
@raw_table = raw_table
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def name
|
|
60
|
+
@raw_table.name
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def columns
|
|
64
|
+
raw_columns = {}
|
|
65
|
+
raw_columns["_id"] = create_pseudo_column("_id")
|
|
66
|
+
if @raw_table.key_type
|
|
67
|
+
raw_columns["_key"] = create_pseudo_column("_key")
|
|
68
|
+
end
|
|
69
|
+
Columns.new(@raw_schema, @raw_table.columns.merge(raw_columns))
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
private
|
|
73
|
+
def create_pseudo_column(name)
|
|
74
|
+
raw_column = {
|
|
75
|
+
"name" => name,
|
|
76
|
+
"indexes" => [],
|
|
77
|
+
}
|
|
78
|
+
Groonga::Client::Response::Schema::Column.new(@raw_schema, raw_column)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
class Columns
|
|
83
|
+
include Enumerable
|
|
84
|
+
|
|
85
|
+
def initialize(raw_schema, raw_columns)
|
|
86
|
+
@raw_schema = raw_schema
|
|
87
|
+
@raw_columns = raw_columns
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def exist?(name)
|
|
91
|
+
@raw_columns.key?(name)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def names
|
|
95
|
+
@raw_columns.keys
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def [](name)
|
|
99
|
+
@raw_columns[name]
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def each
|
|
103
|
+
@raw_columns.each do |name, column|
|
|
104
|
+
yield(name, column)
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
|
2
|
+
#
|
|
3
|
+
# This library is free software; you can redistribute it and/or
|
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
5
|
+
# License as published by the Free Software Foundation; either
|
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
11
|
+
# Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
14
|
+
# License along with this library; if not, write to the Free Software
|
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16
|
+
|
|
17
|
+
require "groonga/client/spec-helper"
|
|
18
|
+
|
|
19
|
+
module GroongaClientModel
|
|
20
|
+
module SpecHelper
|
|
21
|
+
extend ActiveSupport::Concern
|
|
22
|
+
|
|
23
|
+
included do
|
|
24
|
+
include Groonga::Client::SpecHelper
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|