We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug
Timestamps cannot be used to generate stable cursors since they are serialized with precision of seconds
https://github.com/bibendi/graphql-connections/blob/c979406fc407216384fbe80351c1cf749794eae8/lib/graphql/connections/base.rb#L42
To Reproduce
graphql
created_at
class User < ApplicationRecord end module Types class UserType < Types::BaseObject field :id, ID, null: false end end module Types class QueryType < Types::BaseObject field :users, Types::UserType.connection_type, null: false def users GraphQL::Connections::Stable.new(User.all, primary_key: :created_at) end end end
The generated SQL looks like this:
SELECT "users".* FROM "users" WHERE "users"."created_at" > '2021-11-10 14:26:19' ORDER BY "users"."created_at" ASC LIMIT 10
Expected behavior The SQL query should include milliseconds to avoid skipping records that were created in the same second:
SELECT "users".* FROM "users" WHERE "users"."created_at" > '2021-11-10 14:26:19.152283' ORDER BY "users"."created_at" ASC LIMIT 10
To achieve it, serialize times with higher precision
# lib/graphql/connections/base.rb def serialize(cursor) case cursor when Time, DateTime, Date cursor.iso8601(9) else cursor.to_s end end
Context (please complete the following information):
rails
The text was updated successfully, but these errors were encountered:
Hi! Makes sense!
Sorry, something went wrong.
No branches or pull requests
Describe the bug
Timestamps cannot be used to generate stable cursors since they are serialized with precision of seconds
https://github.com/bibendi/graphql-connections/blob/c979406fc407216384fbe80351c1cf749794eae8/lib/graphql/connections/base.rb#L42
To Reproduce
graphql
gem.created_at
.The generated SQL looks like this:
Expected behavior
The SQL query should include milliseconds to avoid skipping records that were created in the same second:
To achieve it, serialize times with higher precision
Context (please complete the following information):
graphql
gem: 1.14rails
: 6.1The text was updated successfully, but these errors were encountered: