Braayy / worm

A java mysql ORM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Worm

It's a Java ORM for MySQL


Topics


πŸͺ± What is Worm?

Worm is a Java ORM for Mysql, you can make simple query using:

User user = new User(); //User is a class that extends WormTable
user.Get(2);

πŸ”§ Installation

Installation with maven

First, add Worm's repository into pom.xml:

<repositories>
    ...
    <repository>
        <id>worm</id>
        <url>https://repo.gump.dev/snapshots/</url>
    </repository>
</repositories>

Then, add Worm's dependency too:

<dependencies>
    ...
    <dependency>
        <groupId>dev.gump</groupId>
        <artifactId>worm</artifactId>
        <version>1.0-SNAPSHOT</version>
        <scope>compile</scope>
    </dependency>
</dependencies>

Installation with Gradle

First, add Worm's repository into build.gradle:

repositories {
    ...
    mavenCentral()
    maven {
        name = 'worm'
        url = 'https://repo.gump.dev/snapshots/'
    }
}

Then, add Worm's dependency too:

    dependencies {
        ...
        compile 'dev.gump:worm:1.0-SNAPSHOT'
    }

(i don't know if this is right, i don't use Gradle :P)


πŸ“ Getting Started

To get started we need to start Worm and declare your connection, use in main class:

  public static void main(String[] args) {
      WormConnection connection = new WormConnection(host, port, database, user, password);
      WormConnector.init(connection);
  }
}

Then create a class that extends WormTable:

  public class User extends WormTable {
    public String User_id, Name, Email;

    static List<WormColumn> columns = Arrays.asList(
      new WormColumn("User_id", "VARCHAR(36)", true), //First param is column name, secound is mysql creation and last is if the column is id or not
      new WormColumn("Name", "VARCHAR(36)"),
      new WormColumn("Email", "VARCHAR(36")
    );

    public User() {
      super(columns); //use this for declare the class columns in mysql
    }
  }

Now you can use:

  User user = new User();
  user.Get("87bf4ec7-9051-47a1-b9f4-eea9b9ed8959")

If you wanna learn more Click here to see documentation


πŸ€” FAQ

  • Why you created that? Cuz is so boring to create SQL querys and treat on Java, and I'm lazy
  • I Found a BUG! Click here and open an issue
  • Can I help with the project? Sure! just send your PR :D
  • Can I contact you? Yep, send email to contact@gump.dev

πŸ™ Thanks

Thanks to HikariCP, Mysql Connector Java and slf4j

About

A java mysql ORM


Languages

Language:Java 100.0%