💾 Archived View for shiny.bneil.me › notes › dynamodb_pages › index.gmi captured on 2024-08-25 at 00:10:34. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-03-21)

-=-=-=-=-=-=-

Dynamo DB Pages

Dynamo code snippet

Recently got burned because we needed to do a recursive paging through dynamo

var listOfThings []Whatever

err := store.ScanPages(input,
    func (page *dynamodb.ScanOutput, lastPage bool) bool {
        for _, item := range page.Items {
            var whateva Whatever
            if val, ok := item["jval"]; ok {
                err := json.Unmarshal([]byte(*val.S), &whateva)
                if err != nil {
                    return true // its like continue
                }
                listOfThings = append(listOfThings, whateva)
            }
        }
    return !lastPage
})
if err != nil {
    t.Fail()
}

---

updated: 2 October 2021.

to the Index

/ html