databases (setup)

Summary: Restyle of the page, including changes to spelling, grammar, links, and structure (where relevant).

Reviewed By: nikoant

Differential Revision: D35579365

fbshipit-source-id: cb04b5e839b3d4ae74c4a20dd4a2fadd853d4181
This commit is contained in:
Kevin Strider
2022-04-13 02:44:11 -07:00
committed by Facebook GitHub Bot
parent 466ed1badd
commit 567fb5d623

View File

@@ -1,15 +1,20 @@
To use the databases plugin, you need to add the plugin to your Flipper client instance. The plugin is currently only available for Android.
:::note
To use the databases plugin, you need to add it to your Flipper client instance.
The plugin is currently only available for Android.
:::
## Android ## Android
Instantiate and add the plugin in `FlipperClient`. To use the database plugin, instantiate and add the plugin in `FlipperClient`, as shown in the following code:
```java ```java
import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
client.addPlugin(new DatabasesFlipperPlugin(context)); client.addPlugin(new DatabasesFlipperPlugin(context));
``` ```
By default it will list all sqlite databases returned by the context. If you are storing a sqlite database somewhere else, you can specify a `File` to it: By default, it will list all Sqlite databases returned by the context. If you are storing a Sqlite database somewhere else, you can specify a `File` to it:
```java ```java
client.addPlugin(new DatabasesFlipperPlugin(new SqliteDatabaseDriver(context, new SqliteDatabaseProvider() { client.addPlugin(new DatabasesFlipperPlugin(new SqliteDatabaseDriver(context, new SqliteDatabaseProvider() {
@@ -25,7 +30,7 @@ client.addPlugin(new DatabasesFlipperPlugin(new SqliteDatabaseDriver(context, ne
}))); })));
``` ```
If you use a different type of database other than sqlite, you can implement a driver to be able to access it via Flipper. If you use a different type of database other than Sqlite, you can implement a driver to be able to access it via Flipper:
```java ```java
client.addPlugin(new DatabasesFlipperPlugin(new DatabaseDriver(context) { client.addPlugin(new DatabasesFlipperPlugin(new DatabaseDriver(context) {