Skip to content

Commit

Permalink
add NotEqual in FilterOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
kuromukira committed Feb 29, 2020
1 parent 9701152 commit 69701ce
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions LiteDB.Wrapper/LiteDB.Wrapper/LiteDB.Wrapper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<RepositoryUrl>https://github.com/norgelera/LiteDB.Wrapper</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<PackageTags>litedb lite db wrapper simple nosql</PackageTags>
<PackageReleaseNotes>Add FilterOptions to Get and GetPaged</PackageReleaseNotes>
<Version>3.0.1</Version>
<PackageReleaseNotes>Add NotEqual to FilterOptions</PackageReleaseNotes>
<Version>3.0.2</Version>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<FileVersion>3.0.0.0</FileVersion>
</PropertyGroup>
Expand Down
2 changes: 2 additions & 0 deletions LiteDB.Wrapper/LiteDB.Wrapper/wrapper/filter-options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public enum Options
/// <summary></summary>
Equals,
/// <summary></summary>
NotEqual,
/// <summary></summary>
GreaterThan,
/// <summary></summary>
LesserThan,
Expand Down
4 changes: 4 additions & 0 deletions LiteDB.Wrapper/LiteDB.Wrapper/wrapper/litedb-wrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ T ICollectionRef<T>.Get(FilterOptions filter)
return _collection.FindOne(Query.EQ(filter.FieldName, filter.FieldValue));
case FilterOptions.Options.Within:
return _collection.FindOne(Query.In(filter.FieldName, filter.FieldValue));
case FilterOptions.Options.NotEqual:
return _collection.FindOne(Query.Not(filter.FieldName, filter.FieldValue));
default:
return _collection.FindOne(Query.EQ(filter.FieldName, filter.FieldValue));
}
Expand All @@ -142,6 +144,8 @@ PagedResult<T> ICollectionRef<T>.GetPaged(FilterOptions filterOptions, PageOptio
return new PagedResult<T>(_countAll, _collection.Find(Query.EQ(filterOptions.FieldName, filterOptions.FieldValue)).ToList());
case FilterOptions.Options.Within:
return new PagedResult<T>(_countAll, _collection.Find(Query.In(filterOptions.FieldName, filterOptions.FieldValue)).ToList());
case FilterOptions.Options.NotEqual:
return new PagedResult<T>(_countAll, _collection.Find(Query.Not(filterOptions.FieldName, filterOptions.FieldValue)).ToList());
default:
return new PagedResult<T>(_countAll, _collection.Find(Query.EQ(filterOptions.FieldName, filterOptions.FieldValue)).ToList());
}
Expand Down

0 comments on commit 69701ce

Please sign in to comment.