https://github.com/yegor256/tojos
Text Object Java Objects (TOJOs): an object representation of a multi-line structured text file like CSV, YAML, or JSON
https://github.com/yegor256/tojos
csv file-format java json
Last synced: 4 months ago
JSON representation
Text Object Java Objects (TOJOs): an object representation of a multi-line structured text file like CSV, YAML, or JSON
- Host: GitHub
- URL: https://github.com/yegor256/tojos
- Owner: yegor256
- License: mit
- Created: 2021-12-23T16:54:45.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-03-17T19:11:45.000Z (4 months ago)
- Last Synced: 2025-03-22T21:06:44.830Z (4 months ago)
- Topics: csv, file-format, java, json
- Language: Java
- Homepage:
- Size: 418 KB
- Stars: 20
- Watchers: 4
- Forks: 12
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# NoSQL Single-File Database
[](https://www.elegantobjects.org)
[](http://www.rultor.com/p/yegor256/tojos)
[](https://www.jetbrains.com/idea/)[](https://github.com/yegor256/tojos/actions/workflows/mvn.yml)
[](http://www.0pdd.com/p?name=yegor256/tojos)
[](https://codeclimate.com/github/yegor256/tojos/maintainability)
[](https://maven-badges.herokuapp.com/maven-central/com.yegor256/tojos)
[](http://www.javadoc.io/doc/com.yegor256/tojos)
[](https://codecov.io/gh/yegor256/tojos)
[](https://hitsofcode.com/view/github/yegor256/tojos)
[](https://github.com/yegor256/tojos/blob/master/LICENSE.txt)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`:
```xml
com.yegor256
tojos
0.18.5```
Then, to manage `books.csv` file:
```java
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](https://www.yegor256.com/2014/04/15/github-guidelines.html).
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:```bash
mvn clean install -Pqulice
```You will need Maven 3.3+ and Java 8+.
## How Fuzz Testing Works
We use [JQF](https://github.com/rohanpadhye/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:```bash
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:```bash
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.