ReplDBManager || A Java Client For ReplDB
h
EpicGamer007

ReplDBManager V 1.0

ReplDBManager is a client for replers to use to easily manage the Database in their java repl project.

This was created by @AbhayBhat

The creator has also received help from:

  • @Scoder12 - Helped with getting data from the Database(Setting up the network connection)
  • @Coder100 - Also helped with getting data from the Database(Setting up the network connection)
  • @Jakman - Helped with Testing and feedback
  • @SixBeeps - Helped with fixing and improving the client

Setting up ReplDBManager:

As of V 1.0, the only ways to get ReplDBManager into your repl currently is to fork this repl or copy-pasting the code in a file called ReplDBManager.java. Source can be found here.

A jar is planned to come out shortly.

Using the Class

Setting it up in your project

Declaring the Client is like so:

Pass in the url to your repl database by by using System.getenv().

If you are using this on your os, remember to get the link from here then use it from your computer because REPL_DB_URL will most likely not be one of your environment variables already

Noteable Instance variables

  • boolean toUpper - If true, all new key-value pairs will be converted to uppercase before going into the database. Set to false by default

Using it's methods

IT IS IMPORTANT TO NOTE THAT THESE METHODS ALL throws IOException, InterruptedException

The available methods in ReplDBManager as of V 1.0 is:

  • void setValue(String key, String value) - sets the key to value in the database. If key is not already present, it will be created
  • void setValues(Map<String, String> things) - sets all the key's in the Map to the value's in the map. Example:
  • String getValue(String key) - returns the value associated with the key
  • String[] getKeys() - returns all keys in the database
  • HashMap<String, String> getAll() - returns every key with every value associated with the key
  • void deleteValue(String key) - deletes the value associated with the key and the key from the database
  • void deleteValues(String[] keys) - deletes all the values associated with the keys and the key from the database
  • void deleteAll() - Deletes ALL the key-value pairs from the database
  • void setToUpper(boolean newB) - sets the toUpper variable to newB
  • boolean getToUpper(boolean newB) - gets the variable toUpper

Notes: If parameters passed to any of the setValue methods contain a ' ', it will be converted to '-'. Example:

Will print:

That is all. I hope y'all enjoy it.

Happy Coding :D

Edit: Added no-arg constructor which initializes url to database with System.getenv("REPLIT_DB_URL");.
Edit: You need Java 11 for this to work. The java.net.http packages are only a part of hava 11

You are viewing a single comment. View All
Coder100

nice!! C# time

EpicGamer007

@Coder100, good luck!

Coder100
SixBeeps

@Coder100 I'll make one that's better than yours good luck with that!

EpicGamer007

@SixBeeps, good luck to you as well!