Ejemplo n.º 1
0
        private static void AddGSIToMap(string indexName, GlobalSecondaryIndexDetails gsiHashKeyResult, Dictionary <string, GlobalSecondaryIndex> gsiMap)
        {
            var gsi = new GlobalSecondaryIndex();

            gsi.IndexName = indexName;
            var gsiHashKey = new KeySchemaElement(gsiHashKeyResult.Prop.Name, KeyType.HASH);

            gsi.KeySchema.Add(gsiHashKey);
            gsiMap.Add(gsi.IndexName, gsi);
        }
Ejemplo n.º 2
0
        private static void UpdateGSIMapWithRangeKey(Dictionary <string, GlobalSecondaryIndex> gsiMap, string indexName,
                                                     GlobalSecondaryIndexDetails gsiRangeKeyResult)
        {
            if (!gsiMap.TryGetValue(indexName, out GlobalSecondaryIndex entry))
            {
                throw new InvalidOperationException(
                          $"The global secondary index {gsiRangeKeyResult.Prop.Name} lacks a hash key");
            }

            var gsiRangeKey = new KeySchemaElement(gsiRangeKeyResult.Prop.Name, KeyType.RANGE);

            entry.KeySchema.Add(gsiRangeKey);
        }