Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support pagination #247

Merged
merged 14 commits into from
May 28, 2015
Merged

Support pagination #247

merged 14 commits into from
May 28, 2015

Commits on May 26, 2015

  1. Configuration menu
    Copy the full SHA
    3d60d13 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8e3d0cb View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d7bec60 View commit details
    Browse the repository at this point in the history
  4. Add initial implementation of pagination

    This change adds a <Operation>Pages() operation to each operation
    with pagination configuration to return an iterator that can be
    used like slice iteration:
    
    	db := dynamodb.New(nil)
    	for resp := range db.ListTablesPages() {
    		fmt.Println(resp)
    	}
    
    References #58
    lsegal committed May 26, 2015
    Configuration menu
    Copy the full SHA
    3664ecc View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    8afc35d View commit details
    Browse the repository at this point in the history
  6. Update pagination API to take a function callback instead.

    New API:
    
    	func main() {
    		db := dynamodb.New(nil)
    		params := &dynamodb.ListTablesInput{Limit: aws.Long(2)}
    		i := 0
    		db.ListTablesPages(params, func(p *dynamodb.ListTablesOutput, err error) bool {
    			if err != nil {
    				fmt.Println("An error occurred", err)
    			} else if p != nil {
    				i++
    				fmt.Println(i, awsutil.StringValue(p))
    			} else {
    				fmt.Println("Finished paging!")
    			}
    			return true // return false to stop paging
    		})
    
    	}
    
    Also adds pagination tests.
    
    References #58
    lsegal committed May 26, 2015
    Configuration menu
    Copy the full SHA
    6e04917 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    85eb3ca View commit details
    Browse the repository at this point in the history
  8. Update path_value.go

    lsegal committed May 26, 2015
    Configuration menu
    Copy the full SHA
    b707d11 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    f48654a View commit details
    Browse the repository at this point in the history
  10. Import unit test helper state

    lsegal committed May 26, 2015
    Configuration menu
    Copy the full SHA
    8856ba3 View commit details
    Browse the repository at this point in the history
  11. Update pagination API to return error from operation.

    New API:
    
    	numPages := 0
    	err := req.EachPage(func(p *dynamodb.ListTablesOutput, last bool) {
    		// Print a page of data
    		numPages++
    		fmt.Printf("Page %d: %x\n", numPages, p.TableNames)
    
    		if last { // We are on the last page
    			fmt.Println("Got to last page")
    		}
    	})
    
    	if err != nil {
    		panic(err)
    	}
    lsegal committed May 26, 2015
    Configuration menu
    Copy the full SHA
    a1152b9 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    c6c3091 View commit details
    Browse the repository at this point in the history
  13. Various pagination refactors

    - Document use of nil reflect.Value with Call()
    - Rename "result" to "shouldContinue"
    - Use "SetValueAtAnyPath" to match case insensitive matches
    - Copy parameters when sending new request (add test assertion for this)
    lsegal committed May 26, 2015
    Configuration menu
    Copy the full SHA
    0eea626 View commit details
    Browse the repository at this point in the history

Commits on May 28, 2015

  1. Add support for multi-token pagination rules

    Also refactor and add tests for truncation logic
    lsegal committed May 28, 2015
    Configuration menu
    Copy the full SHA
    bad551f View commit details
    Browse the repository at this point in the history