如何在 aws-sdk-go Dynamodb QueryInput 中使用 "BETWEEN"?

How to use "BETWEEN" in aws-sdk-go Dynamodb QueryInput?

我正在为 dynamodb 使用 aws-sdk-go。我需要从我的数据库中收集一些项目。过滤条件为deviceid:xyz,time >= 10 and time <= 20.

time 是我的数据库的排序键,deviceid 是主键。我知道我必须使用 BETWEEN 来实现我的目标。我的实现不成功,如下:

var queryInput = &dynamodb.QueryInput{
    TableName: aws.String(dbName),
    KeyConditions: map[string]*dynamodb.Condition{
        "deviceid": {
            ComparisonOperator: aws.String("EQ"),
            AttributeValueList: []*dynamodb.AttributeValue{
                {
                    S: aws.String("xyz"),
                },
            },
        },
        "time": {
            ComparisonOperator: aws.String("BETWEEN"),
            AttributeValueList: []*dynamodb.AttributeValue{
                {
                    N: aws.String("10"),
                    N: aws.String("20"),
                },
            },

        },
    },
}

我在这里犯了哪些错误?

time 值应按如下所述给出:-

"time": {
            ComparisonOperator: aws.String("BETWEEN"),
            AttributeValueList: []*dynamodb.AttributeValue{
                {
                    N: aws.String("10"),                        
                },
                {
                    N: aws.String("20"),                        
                },
            },
        },