pilagod / gorm-cursor-paginator

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

Cast `NULLReplacement` when `SQLType` is specified #52

Closed jpugliesi closed 1 year ago

jpugliesi commented 1 year ago

Some SQL dialects (like Clickhouse) do not automatically cast strings '%v' to the appropriate column type, resulting in an error when this is attempted. This causes an error when using a paginator.Rule on a non-string type column.

To circumvent this issue, the fix here explicitly casts the NULLReplacement value to the provided SQLType

coveralls commented 1 year ago

Pull Request Test Coverage Report for Build 5394388130


Changes Missing Coverage Covered Lines Changed/Added Lines %
paginator/paginator.go 3 5 60.0%
<!-- Total: 3 5 60.0% -->
Totals Coverage Status
Change from base Build 4999052293: -0.5%
Covered Lines: 355
Relevant Lines: 370

💛 - Coveralls
pilagod commented 1 year ago

@jpugliesi @nikicc That's awesome! Looks perfect to me. If there is no further discussion, I will merge it and release a new version to include this fix.

jpugliesi commented 1 year ago

Great, thank you @pilagod

pilagod commented 1 year ago

@jpugliesi @nikicc I just released v2.4.1 to include this PR. 💪

nikicc commented 1 year ago

@pilagod you're a rockstar 🤟 Thanks so much 🙏