• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

maxcoto/graphoid: Instant GraphQL REST-API for Rails from ActiveRecord or Mongoi ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

maxcoto/graphoid

开源软件地址:

https://github.com/maxcoto/graphoid

开源编程语言:

Ruby 91.7%

开源软件介绍:

graphoid

Build Status Gem Version Maintainability Test Coverage

Generates a full GraphQL API using introspection of Mongoid or ActiveRecord models.

API Dodocumentation

The API Documentation that displays how to use the queries and mutations that Graphoid automatically generates.

Dependency

This gem depends on the GraphQL gem. Please install that gem first before continuing

Installation

Add this line to your Gemfile:

gem 'graphoid'
$ bundle install

Database

Create the file config/initializers/graphoid.rb And configure the database you want to use in it (:mongoid or :active_record)

Graphoid.configure do |config|
  config.driver = :mongoid
end

Usage

You can determine which models will be visible in the API by including the Graphoid Queries and Mutations concerns

class Person
  include Graphoid::Queries
  include Graphoid::Mutations
end

Examples

You can find an example that uses ActiveRecord in the Tester AR folder
And an example with Mongoid in the Tester Mongo folder
In this same repository.

Contributing

  • Live Reload
  • Aggregations
  • Permissions on fields
  • Relation with aliases tests
  • Write division for "every" in Mongoid and AR
  • Sort top level models by association values
  • Filter by Array or Hash.
  • has_one_through implementation
  • has_many_selves tests
  • has_and_belongs_to_many_selves tests
  • Embedded::Many filtering implementation
  • Embedded::One filtering with OR/AND

Testing

$ DRIVER=ar DEBUG=true bundle exec rspec
$ DRIVER=mongo DEBUG=true bundle exec rspec

Thank You !!

Ryan Yeske for the whole idea and for validating that metaprogramming this was possible.

Andres Rafael for working so hard on connecting the gem on the frontend and finding its failures.

License

The gem is available as open source under the terms of the MIT License.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
la-process-and-theory/github-api: R code to pull from Gitub发布时间:2022-06-13
下一篇:
Graphoid v0.1.0发布时间:2022-06-13
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap