Skip to content

mikcsabee/ChickenDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ChickenDB

ChickenDB is a basic in-memory database. Basically a HashMap with some useful features.


Usage

Initialization

ChickenDB<String, User> db = new ChickenDB<>();

Defining a Filter

/**
 * This Filter helps to find all User with the given Status
 */
public class StatusFilter  implements IFilter<User> {
  private Status status;
	
  /**
   * @param status The given status
   */
  public StatusFilter(Status status) {
    this.status = status;
  }
	
  /**
    * Validator method
    */
  @Override
  public boolean validate(User item) {
    return item.getStatus() == status;
  }
}

Searching

ChickenDB<String, User> result = db.filter(new StatusFilter(Status.ONLINE))
                                   .filter(/* Other filter... */);

Searching v2 (when the expression is simple)

ChickenDB<String, User> result = db.filter(user -> user.getStatus() == Status.ONLINE)
                                   .filter(/* Other filter... */);

Maven

Soon...

About

A basic in memory database.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages