不支持查询关键条件

I am trying to get all rows past a certain time stamp.

I have also tried using "GE", "LE", "GT" in the condition but I get a syntax error.

I get the following DynamoDB error:

Internal Server Error [ValidationException: Query key condition not supported
    status code: 400,

I have the following table

Table name  GroupsLambda3
Primary partition key   id (String)
Primary sort key    -
Point-in-time recovery  DISABLEDEnable
Encryption Type DEFAULTManage Encryption
KMS Master Key ARN  Not Applicable
Time to live attribute  DISABLEDManage TTL

Then I have created asecondary index on

Name: unix_time-index
Status: Active
Type: GSI
Partition Key: unix_time (Number)
Sort Key: unix_time-index

Finally my Golang code is:

    var cond string
    cond = "unix_time <= :v_unix_time"
    var projection string
    projection = "id, num_users, salesforce_campaign, unix_time"
    input := &dynamodb.QueryInput{
        TableName:              aws.String(table),
        IndexName:              aws.String("unix_time-index"),
        KeyConditionExpression: &cond,
        ProjectionExpression:   &projection,
        ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{
            ":v_unix_time": {
                N: aws.String("1558130473454419"),
            },
        },

The code works when I do cond = "unix_time = :v_unix_time", equals only.

I expect all rows with a lesser unix_timestamp.

You should use expression Builder:

// todo: please check if value should be converted to another type in your case
keyCond := expression.Key("unix_time").LessThenEqual(expression.Value("1558130473454419"))
proj := expression.NamesList(expression.Name("id"), expression.Name("num_users"), expression.Name("salesforce_campaign"), expression.Name("unix_time"))

expr, err := expression.NewBuilder().
    WithKeyCondition(keyCond).
    WithProjection(proj).
    Build()
if err != nil {
    fmt.Println(err)
}

input := &dynamodb.QueryInput{
    ExpressionAttributeValues: expr.Values(),
    KeyConditionExpression:    expr.KeyCondition(),
    ProjectionExpression:      expr.Projection(),
    TableName:                 aws.String(table),
}