Skip to content

laamella-gad/dtotabase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dtotabase

The most basic in-memory database in the world.

Why?

Because for test code I needed a data structure where I could easily store DTO's (or just any object) and get them out again in various ways with the least amount of hassle.

Of course, we have maps and lists and sets and everything, but this project treats DTO's more like database rows. You can do SELECT, INSERT, DELETE and UPDATE, by using functions. Hence "DTO Database."

It's incredibly basic, anybody could make it in an hour. Well, I saved you that hour.

Maven

Here it is: Maven Central

Usage

(This is all taken from the unit tests.)

Create a table

DtoTable<Address> addressTable = new DtoTable<>()

Subclass it if you like to add more methods.

Put some data in

addressTable.insert(address1, address2)

Duplicates (objects which are equals) will be ignored

Retrieve some data

Set<Address> selected = addressTable.select(r -> r.number > 50)

This is the big advantage of Dtotabase: quickly select data in any way you like with just a simple lambda expression.

Update some data

addressTable.update(
        address -> address.number > 50,
        address -> address.number *= 2)

Delete some data

addressTable.delete(r -> r.name.contains("lane"))

Support

There may not be much activity since this project is very small, but I do intend to support it. Do report issues when you like more features or find bugs.

About

The most basic in-memory database in the world

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages