Giter Site home page Giter Site logo

thepepeyt / databasehelper Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 2.0 350 KB

A lightweight, fully reactive and async library for making databases build on Rxjava

License: GNU General Public License v3.0

Java 100.00%
database mysql java rxjava3 sqlite3 postgresql library mariadb

databasehelper's Introduction

databaseimg

👋 Hello!

DatabaseHelper is lightweight library that makes using databases a lot faster

🔩 Installation

Get it on jitpack DatabaseHelper

📙Examples

Connect

Creates connection beetwen your code and database

SQLite3 db = DatabaseHelper.sqLite3Builder()
  .file(new File("database.db"))
  .build();
  
db.connect();

Disconnect

Disconnects code from the database

SQLite3 db = DatabaseHelper.sqLite3Builder()
  .file(new File("database.db"))
  .build();

db.disconnect();

Rows

insertData

Insert data to table

SQLite3 db = new SQLite3(new File("database.db"));

db.connect();

//Inserts into "mycolumn" value "myvalue" in table "mytable"
db.insertData().table("mytable").insert("mycolumn", "myvalue").executeAsync();

getData

Get data from table

SQLite3 db = new SQLite3(new File("database.db"));

db.connect();

//Gets data "PLAYERNAME" and "PLAYERMONEY" where "PLAYERID" is "SOMEID" and hashmap of it
var data = db.getData().table("TABLE")
  .columns("PLAYERNAME", "PLAYERMONEY")
  .where("PLAYERID", "SOMEID").completeAsync();

data.subscribe(System.out::println);

updateData

Update data from database

SQLite3 db = new SQLite3(new File("database.db"));

db.connect();

//Updates "MYCOLUMN" by value "myvalue" in table "TABLE"
db.updateData().table("TABLE").column("MYCOLUMN", "myvalue").executeAsync();

deleteData

Delete data from database

SQLite3 db = new SQLite3(new File("database.db"));

db.connect();
        
//Deletes every row from table "TABLE" where "ID" is 100
db.deleteData().table("TABLE").where("ID", 100).executeAsync();

Tables

createTable

Creates table as name says xD

SQLite3 db = new SQLite3(new File("database.db"));

db.connect();
        
//Creates table with column "1COLUMN" that can store TEXT and "2COLUMN" that can store INT
db.createTable().table("TABLE").columns("1COLUMN TEXT", "2COLUMN INT").executeAsync();

Columns

deleteColumn

Delets columns from table

SQLite3 db = new SQLite3(new File("database.db"));

db.connect();

//Deletes 2 columns from table "TABLE"
db.deleteColumn().table("TABLE").columns("1COLUMN", "2COLUMN").executeAsync();

addColumn

Add columns to table

SQLite3 db = new SQLite3(new File("database.db"));

db.connect();

//Add to table "TABLE" columns "3COLUMN" that can store text and add "4COLUMN" that can store 
db.addColumn().table("TABLE").columns("3COLUMN TEXT", "4COLUMN INT").executeAsync();

🚀 Others

If you have any problems join this discord Support or you can contact me on Discord: ThePepeYT#1139.

❤️Thanks to:

Xmonpl for all help with Rxjava
dan1st for all help with small fixes

databasehelper's People

Contributors

thepepeyt avatar tofpu avatar xmonpl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.