Skip to content

Commit

Permalink
Version 1.2.0 (#143)
Browse files Browse the repository at this point in the history
- Version 1.2.0 (no beta anymore)
- Some warnings / info cleanup
  • Loading branch information
akade authored Jun 16, 2024
1 parent ae542e7 commit 0fcac95
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class RehydrationBenchmark
{
private readonly ConcurrentIndexedSet<AggregateId, Aggregate> _set = IndexedSetBuilder<Aggregate>.Create(x => x.Id)
.WithIndex(x => x.Owner)
.WithIndex(x => x.SharedWith.Any())
.WithIndex(x => x.SharedWith.IsEmpty)
.WithIndex(AggregateIndices.TenantsWithAccess)
.WithFullTextIndex(AggregateIndices.FullName)
.BuildConcurrent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void Case_insensitve_lookahead_in_all_types_within_system_runtime()
// Travers the prefix trie to efficiently find all matches
Type[] types = _types.StartsWith(x => x.Name.ToLowerInvariant(), "int").ToArray();

Assert.IsTrue(types.Any());
Assert.IsTrue(types.Length > 0);
Assert.IsTrue(types.All(t => t.Name.StartsWith("int", StringComparison.InvariantCultureIgnoreCase)));
}
}
2 changes: 1 addition & 1 deletion Akade.IndexedSet/Akade.IndexedSet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<PropertyGroup>
<Version>1.2.0-beta</Version>
<Version>1.2.0</Version>
<Description>Provides an In-Memory data structure, the IndexedSet, that allows to easily add indices to allow efficient querying. Currently supports unique and non-unique indices, range indices as well as fuzzy string matching for single attributes, compound or computed keys.</Description>
<Copyright>Copyright © Akade 2024</Copyright>
<Authors>Akade</Authors>
Expand Down
5 changes: 1 addition & 4 deletions Akade.IndexedSet/IndexedSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -749,10 +749,7 @@ public IEnumerable<TElement> FullScan()
private TypedIndex<TElement, TIndexKey> GetIndex<TIndexKey>(string? indexName)
where TIndexKey : notnull
{
if (indexName is null)
{
throw new ArgumentNullException(nameof(indexName));
}
ArgumentNullException.ThrowIfNull(indexName);

if (!_indices.TryGetValue(indexName, out Index<TElement>? index))
{
Expand Down
50 changes: 10 additions & 40 deletions Akade.IndexedSet/IndexedSetBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,7 @@ internal IndexedSetBuilder(IndexedSet<TElement>? indexedSet, IEnumerable<TElemen
public virtual IndexedSetBuilder<TElement> WithUniqueIndex<TIndexKey>(Func<TElement, TIndexKey> keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null)
where TIndexKey : notnull
{
if (indexName is null)
{
throw new ArgumentNullException(nameof(indexName));
}
ArgumentNullException.ThrowIfNull(indexName);

_result.AddIndex(keyAccessor, new UniqueIndex<TElement, TIndexKey>(indexName));

Expand All @@ -134,10 +131,7 @@ public virtual IndexedSetBuilder<TElement> WithUniqueIndex<TIndexKey>(Func<TElem
public virtual IndexedSetBuilder<TElement> WithUniqueIndex<TIndexKey>(Func<TElement, IEnumerable<TIndexKey>> keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null)
where TIndexKey : notnull
{
if (indexName is null)
{
throw new ArgumentNullException(nameof(indexName));
}
ArgumentNullException.ThrowIfNull(indexName);

_result.AddIndex(keyAccessor, new UniqueIndex<TElement, TIndexKey>(indexName));

Expand All @@ -159,10 +153,7 @@ public virtual IndexedSetBuilder<TElement> WithUniqueIndex<TIndexKey>(Func<TElem
public virtual IndexedSetBuilder<TElement> WithIndex<TIndexKey>(Func<TElement, TIndexKey> keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null)
where TIndexKey : notnull
{
if (indexName is null)
{
throw new ArgumentNullException(nameof(indexName));
}
ArgumentNullException.ThrowIfNull(indexName);

_result.AddIndex(keyAccessor, new NonUniqueIndex<TElement, TIndexKey>(indexName));

Expand All @@ -184,10 +175,7 @@ public virtual IndexedSetBuilder<TElement> WithIndex<TIndexKey>(Func<TElement, T
public virtual IndexedSetBuilder<TElement> WithIndex<TIndexKey>(Func<TElement, IEnumerable<TIndexKey>> keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null)
where TIndexKey : notnull
{
if (indexName is null)
{
throw new ArgumentNullException(nameof(indexName));
}
ArgumentNullException.ThrowIfNull(indexName);

_result.AddIndex(keyAccessor, new NonUniqueIndex<TElement, TIndexKey>(indexName));

Expand All @@ -209,10 +197,7 @@ public virtual IndexedSetBuilder<TElement> WithIndex<TIndexKey>(Func<TElement, I
public virtual IndexedSetBuilder<TElement> WithRangeIndex<TIndexKey>(Func<TElement, TIndexKey> keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null)
where TIndexKey : notnull
{
if (indexName is null)
{
throw new ArgumentNullException(nameof(indexName));
}
ArgumentNullException.ThrowIfNull(indexName);

_result.AddIndex(keyAccessor, new RangeIndex<TElement, TIndexKey>(indexName));

Expand All @@ -234,10 +219,7 @@ public virtual IndexedSetBuilder<TElement> WithRangeIndex<TIndexKey>(Func<TEleme
public virtual IndexedSetBuilder<TElement> WithRangeIndex<TIndexKey>(Func<TElement, IEnumerable<TIndexKey>> keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null)
where TIndexKey : notnull
{
if (indexName is null)
{
throw new ArgumentNullException(nameof(indexName));
}
ArgumentNullException.ThrowIfNull(indexName);

_result.AddIndex(keyAccessor, new MultiRangeIndex<TElement, TIndexKey>(indexName));

Expand All @@ -257,10 +239,7 @@ public virtual IndexedSetBuilder<TElement> WithRangeIndex<TIndexKey>(Func<TEleme
/// <returns>The instance on which this method is called is returned to support the fluent syntax.</returns>
public virtual IndexedSetBuilder<TElement> WithFullTextIndex(Func<TElement, string> keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null)
{
if (indexName is null)
{
throw new ArgumentNullException(nameof(indexName));
}
ArgumentNullException.ThrowIfNull(indexName);

_result.AddIndex(keyAccessor, new FullTextIndex<TElement>(keyAccessor, indexName));

Expand All @@ -281,10 +260,7 @@ public virtual IndexedSetBuilder<TElement> WithFullTextIndex(Func<TElement, stri
[Experimental(Experiments.TextSearchImprovements, UrlFormat = Experiments.UrlTemplate)]
public virtual IndexedSetBuilder<TElement> WithFullTextIndex(Func<TElement, IEnumerable<string>> keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null)
{
if (indexName is null)
{
throw new ArgumentNullException(nameof(indexName));
}
ArgumentNullException.ThrowIfNull(indexName);

_result.AddIndex(keyAccessor, new FullTextIndex<TElement>(keyAccessor, indexName));

Expand All @@ -304,10 +280,7 @@ public virtual IndexedSetBuilder<TElement> WithFullTextIndex(Func<TElement, IEnu
/// <returns>The instance on which this method is called is returned to support the fluent syntax.</returns>
public virtual IndexedSetBuilder<TElement> WithPrefixIndex(Func<TElement, string> keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null)
{
if (indexName is null)
{
throw new ArgumentNullException(nameof(indexName));
}
ArgumentNullException.ThrowIfNull(indexName);

_result.AddIndex(keyAccessor, new PrefixIndex<TElement>(indexName));

Expand All @@ -328,10 +301,7 @@ public virtual IndexedSetBuilder<TElement> WithPrefixIndex(Func<TElement, string
[Experimental(Experiments.TextSearchImprovements, UrlFormat = Experiments.UrlTemplate)]
public virtual IndexedSetBuilder<TElement> WithPrefixIndex(Func<TElement, IEnumerable<string>> keyAccessor, [CallerArgumentExpression("keyAccessor")] string? indexName = null)
{
if (indexName is null)
{
throw new ArgumentNullException(nameof(indexName));
}
ArgumentNullException.ThrowIfNull(indexName);

_result.AddIndex(keyAccessor, new PrefixIndex<TElement>(indexName));

Expand Down

0 comments on commit 0fcac95

Please sign in to comment.