Skip to content

Paginator for the :many context? #978

Closed

Description

@basilex

Hi, All!
Is there a solution to paginate :many context?
Thanx a lot!

Activity

  1. videate-karim commented on Apr 17, 2021

    @videate-karim

    In my reading of the docs, you would do:

    -- name: GetThings :many
    SELECT * FROM things
     WHERE field = $1
     ORDER BY created_at desc
     LIMIT $2 OFFSET $3;

    The generated function looks like this:

    type GetThingsParams struct {
    	Field string
    	Limit    int32
    	Offset   int32
    }
    
    type GetThingsRow struct {
    	ID          int32
    	Field      string
           ...
    }
    func (q *Queries) GetThings(ctx context.Context, arg GetThingsParams) ([]GetThingRow, error) {
       ...
    }
  2. locked and limited conversation to collaborators on Sep 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions