从DynamoDB获取最新的多个值

时间:2018-04-24 02:37:40

标签: go nosql amazon-dynamodb amazon-dynamodb-streams

如果我有如下表格:

/**
 * Checks the current alert dialog displayed (on the top of the window stack) has the expected contents.
 *
 * From https://stackoverflow.com/a/48654878/8355496
 * Licenced under cc by-sa 3.0 with attribution required https://creativecommons.org/licenses/by-sa/3.0/
 * @param expectedHeader Expected header of the dialog
 * @param expectedContent Expected content of the dialog
 */
private void alertDialogHasHeaderAndContent(final String expectedHeader, final String expectedContent) {
    final Stage actualAlertDialog = getTopModalStage();
    assertNotNull(actualAlertDialog);

    final DialogPane dialogPane = (DialogPane) actualAlertDialog.getScene().getRoot();
    assertEquals(expectedHeader, dialogPane.getHeaderText());
    assertEquals(expectedContent, dialogPane.getContentText());
}

/**
 * Get the top modal window.
 *
 * Adapted from https://stackoverflow.com/a/48654878/8355496
 * Licenced under cc by-sa 3.0 with attribution required https://creativecommons.org/licenses/by-sa/3.0/
 * @return the top modal window
 */
private Stage getTopModalStage() {
    // Get a list of windows but ordered from top[0] to bottom[n] ones.
    // It is needed to get the first found modal window.
    final List<Window> allWindows = new ArrayList<>(new FxRobot().robotContext().getWindowFinder().listWindows());
    Collections.reverse(allWindows);

    return (Stage) allWindows
            .stream()
            .filter(window -> window instanceof Stage)
            .findFirst()
            .orElse(null);
}

我想基于一对(A,B)和最新日期(D)得到最新版本,我如何设置一个表来处理这个请求,以及我将使用什么样的查询检索那个?

输出将为我提供ID为ASEF和ASFA的值。

我使用aws-go-sdk来运行它,但我应该能够将任何解决方案转换为该SDK。

1 个答案:

答案 0 :(得分:0)

您应该将属性A用作HashKey(PartitionKey),将Date用作RangeKey(SortKey)。使用partitionKey时,只能使用相等条件(==)。 RangeKey支持&lt;,&gt;,=,Between operations。

Check this link