JsonDB/JsonDB.cs

49 lines
788 B
C#
Raw Permalink Normal View History

2024-08-12 12:02:12 +09:00
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);
}
2024-08-12 12:30:07 +09:00
public bool Has(T item)
{
return this.store.Has(item);
}
public bool Remove(T item)
{
return this.store.Remove(item);
}
2024-08-12 12:02:12 +09:00
public IEnumerable<T> GetValues()
{
return this.store.GetValues();
}
public IEnumerable<T> GetValues(Func<T, bool> filter)
{
return this.store.GetValues().Where(filter).ToList();
}
}