Friday, May 5, 2017

JSInterop for Lovefield database

Hello,

I'm working on Lovefield bindings for JSInterop. While the basic stuff (init, insert, ...) works with the elemental2-promise-beta quite well, I'd like to have bindings for the Lovefield query mechanism as well.

Sadly I don't know how to write the matching Java classes. Consider the following code (adapted from https://github.com/google/lovefield/blob/master/docs/spec/04_query.md):

var infoCard = db.getSchema().table('InfoCard');
db
.select().
   
from(infoCard).
    orderBy
(infoCard.lang, lf.Order.ASC).
    orderBy
(infoCard.itag)

Here are the (stripped) Java classes so far:

@JsType(isNative = true)
public class QueryBuilder {
   
public native QueryBuilder from(Table table);
   
   
public native QueryBuilder orderBy(???);
}


@JsType(isNative = true)
public class Table {
}


Instances of QueryBuilder and Table are created via factories. What would be the right implementation of orderBy. As you can see the parameter has to be the property of the Table object. As far as I know, Java doesn't provid such "pointers".

Another interesting aspect would be around search conditions (https://github.com/google/lovefield/blob/master/docs/spec/04_query.md#413-search-conditions). Seems like they are realized via some kind of function pointers.

Is this even possible with JSInterop or do I have to write some amount of glue code in JS-land?

Thanks in advance
Klemens

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment