private CBForestDocEnumerator GetDocEnumerator(QueryOptions options, out List<string> remainingIDs) { var forestOps = options.AsC4EnumeratorOptions(); var enumerator = default(CBForestDocEnumerator); remainingIDs = new List<string>(); if(options.Keys != null) { try { remainingIDs = options.Keys.Cast<string>().ToList(); enumerator = new CBForestDocEnumerator(Forest, remainingIDs.ToArray(), forestOps); } catch(InvalidCastException) { Log.E(TAG, "options.keys must contain strings"); throw; } } else { enumerator = new CBForestDocEnumerator(Forest, options.StartKey as string, options.EndKey as string, forestOps); } return enumerator; }
private CBForestDocEnumerator GetDocEnumerator(QueryOptions options, out List<string> remainingIDs) { var forestOps = options.AsC4EnumeratorOptions(); var enumerator = default(CBForestDocEnumerator); remainingIDs = new List<string>(); if(options.Keys != null) { try { remainingIDs = options.Keys.Cast<string>().ToList(); enumerator = new CBForestDocEnumerator(Forest, remainingIDs.ToArray(), forestOps); } catch(InvalidCastException) { Log.To.Database.E(TAG, "options.keys must contain strings"); throw; } } else { string startKey, endKey; if(options.Descending) { startKey = Misc.KeyForPrefixMatch(options.StartKey, options.PrefixMatchLevel) as string; endKey = options.EndKey as string; } else { startKey = options.StartKey as string; endKey = Misc.KeyForPrefixMatch(options.EndKey, options.PrefixMatchLevel) as string; } enumerator = new CBForestDocEnumerator(Forest, startKey, endKey, forestOps); } return enumerator; }