question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

API generification

See original GitHub issue

This issue is rather an open discussion about how the client will handle multiple back-ends, the concerns we want to address are:

  • naming the project and the package
  • how to handle specific backend operations (PG has notifications/notices, MY has ping, etc…)

Current WIP for MySQL support https://github.com/reactiverse/reactive-pg-client/tree/mysql_support

Naming

  • The Reactive SQL Client
    • io.reactiverse.sqlclient
  • The Reactive DB Client
    • io.reactiverse.dbclient
    • io.reactiverse.rdbc
    • io.reactiverse.dbc

Specific operations

Proposal 1

  • Provide a generic API in the project package that does not provide specific operations
  • Each database has its own package and extends the generic API providing specific operations

Examples

public interface DbConnection {
}

public interface PgConnection extends DbConnection {
  // Specific stuff here
}

Issues : we cannot really do this unless with use self bound generics ,i.e

public interface DbClient<C extends DbConnection> {
  void connect(Handler<AsyncResult<C>> handler);
}

public interface PgClient extends DbClient<PgConnection> {
}

unless we don’t abstract PgClient ?

Proposal 2

Flat interface style, provide an API that exposes everything. It is simple but not ideal and certainly won’t help the user.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:27 (19 by maintainers)

github_iconTop GitHub Comments

3reactions
vietjcommented, Mar 10, 2019

I’ve pushed another commit that move more interfaces to the sqlclient package and now it looks ok to me.

  • the io.reactiverse.sqlclient does not leak into io.reactiverse.pgclient for the main types
  • the user will need to cast SqlConnection to PgConnection to access specific API, etc…

I believe the PG specific datatypes will be removed from Row / Tuple and can be used using type tokens:

<T> T get(int index, Class<T> type);

which can used this way:

Numeric numeric = row.get(0, Numeric.class);
1reaction
vietjcommented, Mar 10, 2019

I pushed the specific data type decoupling with PG in the branch https://github.com/reactiverse/reactive-pg-client/tree/api-test-1

I think this branch could be merged in the mysql-support branch as I think the result is satisfying for the moment

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java Management Extensions API Enhancements
Generification. The JMX API now fully supports Generics. ObjectName supports wildcards. key=* wildcards are now supported in ObjectName. Previously, "domain: ...
Read more >
[JDK-8227541] Serial spec should be updated to reflect API ...
Backport - A issue that is required to port a Bug or Feature into another product JDK-8227863 Serial spec should be updated to...
Read more >
Adopting 4.4 mechanisms and APIs - IBM
All of the APIs for Platform Debug have been generified in 4.4. If you have been using the platform debug code in generified...
Read more >
[JDK-8227731] Serial spec should be updated to reflect API ...
The Serialization specification is updated to reflect changes made to the method signatures in previous JDK releases. For example, references to raw classes...
Read more >
Generify A Java Project - Eclipsepedia
Generifying APIs requires special care: Communicate to API clients that you're going to generify APIs. Perform the work in a branch and only ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found