All work

OPEN SOURCE · GO LIBRARY

Dewey

Pagination, sorting, and filtering for Go

// Configure once, apply to any query builder
cfg := pagination.Config[*ent.UserQuery]{
    Limit:  func(q *ent.UserQuery, n int) *ent.UserQuery { return q.Limit(n) },
    Offset: func(q *ent.UserQuery, n int) *ent.UserQuery { return q.Offset(n) },
}

query := client.User.Query()
query = pagination.Apply(query, cfg, 25, 0) // first page, 25 items

Why it exists

Most Go REST APIs reinvent pagination, filtering, and sorting for every project. Dewey pulls those patterns into small, composable, type-safe utilities that work with whatever database layer you already use.

Principles

  • Zero dependencies: only the Go standard library
  • ORM-agnostic: explicit adapter functions instead of assumptions about your stack
  • No reflection: everything stays type-safe at compile time
  • No magic: clear, simple code you can read and debug

What's inside

  • pagination: offset/limit pagination with metadata helpers
  • sort: multi-field ordering with type-safe field mappings
  • filter: structured filters, full-text search, and custom predicates

Dewey is the API layer of the Strawberry stack and pairs with Curator on the frontend.

Related work

Want this kind of work on your product?

Bring us the part of your system that has to be right.

Start a conversation