fogfish / dynamo

Generic Golang Key/Value trait for AWS storage services
MIT License
19 stars 5 forks source link

Support Local/Global Secondary Indexes #37

Closed fogfish closed 3 years ago

fogfish commented 3 years ago

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LSI.html https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.html

fogfish commented 3 years ago
// old
q := &dynamodb.QueryInput{
        KeyConditionExpression:    aws.String(dynamo.pkPrefix + " = :prefix"),
        ExpressionAttributeValues: exprOf(gen),
        TableName:                 dynamo.table,
        IndexName:                 aws.String("test-b-c"),
    }

// new
q := &dynamodb.QueryInput{
        KeyConditionExpression:    aws.String(someKeyNameUsedGSI + " = :prefix"),
        ExpressionAttributeValues: exprOf(gen),
        TableName:                 dynamo.table,
        IndexName:                 aws.String("test-b-c"),
    }
fogfish commented 3 years ago
type SeqConfig interface {
   Index(name string) Seq
}

Index name is configurable via URL

fogfish commented 3 years ago
dynamo.New("ddb:///table-name/index-name?prefix=prefix&suffix=suffix") 
fogfish commented 3 years ago
fogfish commented 3 years ago
fogfish commented 3 years ago
fogfish commented 3 years ago
fogfish commented 3 years ago