Пример #1
0
 public string Inserts(string initialContents)
 {
     TextFile.Spit(_file, initialContents);
     var subject = new JsonDB(_file);
     subject.Insert("foobar", _foobar);
     return TextFile.Slurp(_file).TrimEnd();
 }
Пример #2
0
        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();
        }
Пример #3
0
        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();
        }
Пример #4
0
        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();
        }
Пример #5
0
        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();
        }