public string Inserts(string initialContents) { TextFile.Spit(_file, initialContents); var subject = new JsonDB(_file); subject.Insert("foobar", _foobar); return TextFile.Slurp(_file).TrimEnd(); }
public string Deletes(string initialContents, string keys) { TextFile.Spit(_file, initialContents); var subject = new JsonDB(_file); var keyDict = Read.Dict(keys).SelectVals(TypeConversion.Infervert); subject.Delete("foobar", keyDict); return TextFile.Slurp(_file).TrimEnd(); }
public string Reads(string initialContents, string keys, string fieldsToUse) { TextFile.Spit(_file, initialContents); var subject = new JsonDB(_file); var keyDict = Read.Dict(keys).SelectVals(TypeConversion.Infervert); var fields = Read.List(fieldsToUse); var res = subject.Read("foobar", keyDict, fields); return res.Print(); }
public string EnsureOnlyUpdatesOneRow(string initialContents, string data, string keys) { TextFile.Spit(_file, initialContents); var subject = new JsonDB(_file); var ddata = Read.Dict<string,object>(data); var dkeys = Read.Dict<string,object>(keys); subject.Ensure("table1", ddata, dkeys); return subject.ReadAll("table1").Print(); }
public string Reads_MultipleTables(string initialContents, string table) { TextFile.Spit(_file, initialContents); var subject = new JsonDB(_file); var res = subject.ReadAll(table); return res.Print(); }