
Security News
Rspack Introduces Rslint, a TypeScript-First Linter Written in Go
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.
Integrate Searchkick with GraphQL Connections easily.
The current version of the gem only works with GraphQL::Pagination::Connection
. If you need support for the older GraphQL::Relay::BaseConnection
version use v0.1.0.
If you find any of these undesirable, open an issue or PR.
Add this line to your application's Gemfile:
gem 'graphql-searchkick'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install graphql-searchkick
Include the field integration into your field class.
class BaseField < GraphQL::Schema::Field
include GraphQL::Searchkick::FieldIntegration
end
Add the connection to your schema.
class Schema < GraphQL::Schema
use GraphQL::Pagination::Connections
connections.add(GraphQL::Searchkick::LazySearch, GraphQL::Searchkick::ResultConnection)
end
Add search: ModelClass
to any connection field that you want to allow querying.
field :projects, Types::ProjectType.connection_type, null: false, search: Project
Your field will now have an optional query
argument of type String
as part of it's definition.
If query
is nil?
or empty?
the default value '*'
is used.
If you would like to pass options to the search
method, override the resolver for the field that returns a Hash
.
def projects(arguments)
{
where: {
active: arguments[:active],
coordinates: {
near: arguments[:coords],
within: '1km'
}
}
}
end
This will translate into:
Project.search('*', where: { active: true, coordinates: { near: { lat: 40.815110, lon: -96.709523 }, within: '1km' } })
After checking out the repo, run bin/setup
to install dependencies. Then run docker-compose up
to start Elasticsearch. Finally, run bundle exec appraisal rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/CompanyCam/graphql-searchkick.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that graphql-searchkick demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.
Security News
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.