コード例 #1
0
func ExampleClient_Query(client *dynago.Client) {
	result, err := client.Query("table").
		KeyConditionExpression("Foo = :val AND begins_with(Title, :prefix)").
		Param(":val", 45).Param(":prefix", "The adventures of").
		Execute()

	if err == nil {
		for _, row := range result.Items {
			fmt.Printf("ID: %s, Foo: %d", row["Id"], row["Foo"])
		}
	}
}
コード例 #2
0
func ExampleClient_Query_pagination(client *dynago.Client) {
	query := client.Query("table").
		KeyConditionExpression("Foo = :val").
		Limit(50)

	// Keep getting results in a loop until there are no more.
	for query != nil {
		result, err := query.Execute()
		if err != nil {
			break
		}
		for _, item := range result.Items {
			fmt.Printf("Result ID %d\n", item["Id"])
		}
		query = result.Next()
	}
}