49 lines
788 B
C#
49 lines
788 B
C#
using DevJsonDB.IO;
|
|
|
|
namespace DevJsonDB;
|
|
|
|
public class JsonDB<T> : IDisposable
|
|
{
|
|
private IStore<T> store;
|
|
|
|
public JsonDB(IStore<T> store)
|
|
{
|
|
this.store = store;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
this.store.Dispose();
|
|
}
|
|
|
|
public void Commit()
|
|
{
|
|
this.store.Commit();
|
|
}
|
|
|
|
public bool Add(T item)
|
|
{
|
|
return this.store.Add(item);
|
|
}
|
|
|
|
public bool Has(T item)
|
|
{
|
|
return this.store.Has(item);
|
|
}
|
|
|
|
public bool Remove(T item)
|
|
{
|
|
return this.store.Remove(item);
|
|
}
|
|
|
|
public IEnumerable<T> GetValues()
|
|
{
|
|
return this.store.GetValues();
|
|
}
|
|
|
|
public IEnumerable<T> GetValues(Func<T, bool> filter)
|
|
{
|
|
return this.store.GetValues().Where(filter).ToList();
|
|
}
|
|
}
|