Thanks to visit codestin.com
Credit goes to github.com

Skip to content

yegor256/tojos

Repository files navigation

NoSQL Single-File Database

EO principles respected here DevOps By Rultor.com We recommend IntelliJ IDEA

mvn PDD status Maintainability Maven Central Javadoc codecov Hits-of-Code License

It's a simple manager of "records" in a text file of CSV, JSON, etc. format. It's something you would use when you don't want to run a full database, but just a list of lines in a file is not enough. You need a file with structured records.

You add this to your pom.xml:

<dependency>
  <groupId>com.yegor256</groupId>
  <artifactId>tojos</artifactId>
  <version>0.19.1</version>
</dependency>

Then, to manage books.csv file:

import com.yegor256.tojos.MnCsv;
import com.yegor256.tojos.TjDefault;
import com.yegor256.tojos.Tojo;
import com.yegor256.tojos.Tojos;

Tojos tojos = new TjDefault(new MnCsv("books.csv"));
Tojo t1 = tojos.add("Object Thinking"); // unique ID
t1.set("author", "David West");
Tojo t2 = tojos.select(
    t -> t.get("author").equals("David West")
).get(0);

Each record has a unique ID, which is also the first column.

How to Contribute

Fork repository, make changes, send us a pull request. We will review your changes and apply them to the master branch shortly, provided they don't violate our quality standards. To avoid frustration, before sending us your pull request please run full Maven build:

mvn clean install -Pqulice

You will need Maven 3.3+ and Java 8+.

How Fuzz Testing Works

We use JQF for fuzz testing. It helps us find inputs for some of our tests which are not obvious, but they still break the code. Here is how you can run it:

mvn test jqf:fuzz

If after this step you see any files in the target/fuzz-results/com.yegor256.tojos.Fuzzing/fuzzMnTabs/failures/ directory, you got a few failures, very good! Now, you reproduce them in order to understand what's wrong:

mvn jqf:repro -Dinput=target/fuzz-results/com.yegor256.tojos.Fuzzing/fuzzMnTabs/failures/id_000000

You should see a stack trace and a few lines of code that caused the failure.

About

Text Object Java Objects (TOJOs): an object representation of a multi-line structured text file like CSV, YAML, or JSON

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages