Skip to content

Commit

Permalink
Update README to new wiki documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
aikar committed Mar 14, 2018
1 parent 68aa729 commit 82b1f6d
Showing 1 changed file with 6 additions and 43 deletions.
49 changes: 6 additions & 43 deletions README.md
Expand Up @@ -7,55 +7,18 @@ IDB handles connections, query, execution, result fetching and data return for a
Most Database operations can be completed in a single API call. Most Database operations can be completed in a single API call.


Built currently on top of Hikari Connection Pool. Built currently on top of Hikari Connection Pool.
## Usage
### Version:
1.0.0-SNAPSHOT


### Project Setup ## Getting Started


Add `co.aikar:idb-core` to project. **Version**: `1.0.0-SNAPSHOT`
Bukkit Minecraft Plugins can also add `co.aikar:idb-bukkit` and use `BukkitDB`


### Dependencies Project Setup: [Maven](https://github.com/aikar/db/wiki/Maven-Setup), [Gradle](https://github.com/aikar/db/wiki/Gradle-Setup)


To use this, you need to manually shade in HikariCP to your plugin/app. Getting Started: [Using IDB](https://github.com/aikar/db/wiki/Using-IDB)


With gradle and shadowjar: API Documentation: [IDB API](https://github.com/aikar/db/wiki/IDB-API)
```groovy
dependencies {
compile group: 'com.zaxxer', name: 'HikariCP', version: '2.7.8'
}
```


You also need to make sure your respective JDBC driver (MySQL, etc) is shaded/available Real World Examples: [Examples](https://github.com/aikar/db/wiki/Real-World-Examples)
the mysql setup method expects the following driver:

MySQL: `mysql:mysql-connector-java:5.1.33`, class: `com.mysql.jdbc.jdbc2.optional.MysqlDataSource`

### Initializing
Create a `PooledDatabaseOptions` object, which then requires a `DatabaseOptions` object and create a `HikariPooledDatabase` with it.

Example:

```java
class App {
public static void main() {
Database db = PooledDatabaseOptions
.builder()
.options(
DatabaseOptions.builder()
.mysql("user", "pass", "db", "localhost:3306")
.build()
)
.createHikariDatabase();
DB.setGlobalDatabase(db);
}
}
```

Then you may use any of the static API's in the DB class around your app, and they will use the global database instance.

If you prefer a dependency injection approach, simply pass your Database instance.


## Say Thanks ## Say Thanks
If this library has helped you, please consider donating as a way of saying thanks If this library has helped you, please consider donating as a way of saying thanks
Expand Down

0 comments on commit 82b1f6d

Please sign in to comment.