pilagod / gorm-cursor-paginator

A paginator doing cursor-based pagination based on GORM
https://github.com/pilagod/gorm-cursor-paginator
MIT License
188 stars 44 forks source link

How to use pagination with KSUID package? #56

Closed myrtleTree33 closed 8 months ago

myrtleTree33 commented 11 months ago

Hi,

I am using https://github.com/segmentio/ksuid for IDs.

How can I paginate using this library? I see that the error invalid cursor for paginating is thrown.

pilagod commented 11 months ago

I just did a simple cursor encoding/decoding test for ksuid field, and it didn't encounter any problem.

https://github.com/pilagod/gorm-cursor-paginator/blob/a020d772773c3802988c15f6582ac7cd095c2ac6/cursor/encoding_test.go#L21-L34

Cursor is leveraging encoding/json library to do encoding/decoding, and I think ksuid already handles it correctly.

Could you help providing more code details about how you use ksuid in your model? Thanks.

pilagod commented 8 months ago

I will close this issue for now. Feel free to re-open it for further discussion 🙌