github.com/songzhibin97/gkit@v1.2.13/page_token/page_token.go (about)

     1  package page_token
     2  
     3  // https://google.aip.dev/158
     4  
     5  type PageToken interface {
     6  	TokenGenerator
     7  	ProcessPageTokens
     8  }
     9  
    10  type TokenGenerator interface {
    11  	ForIndex(int) string
    12  	GetIndex(string) (int, error)
    13  }
    14  
    15  type ProcessPageTokens interface {
    16  	// ProcessPageTokens
    17  	// numElements: total number of elements
    18  	// pageSize: number of elements per page
    19  	// pageToken: page token
    20  
    21  	ProcessPageTokens(numElements int, pageSize int, pageToken string) (start, end int, nextToken string, err error)
    22  }