ph.com.nightowlstudios.persistence.query.Query Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of edge Show documentation
Show all versions of edge Show documentation
A simple library for building REST API using Vertx.
package ph.com.nightowlstudios.persistence.query;
import io.vertx.sqlclient.Tuple;
import ph.com.nightowlstudios.entity.Entity;
import java.util.UUID;
/**
* @author Joseph Harvey Angeles - @yev
* @since 9/12/20
*/
public interface Query {
String sql();
Tuple tuple();
static QueryBuilder select(String fromTable) {
return QueryBuilder.select(fromTable);
}
static QueryBuilder select(Class entityClass) {
return QueryBuilder.select(entityClass);
}
static QueryBuilder update(String table) {
return QueryBuilder.update(table);
}
static QueryBuilder update(Class entityClass) {
return QueryBuilder.update(entityClass);
}
static QueryBuilder insert(String into) {
return QueryBuilder.insert(into);
}
static QueryBuilder insert(Class entityClass) {
return QueryBuilder.insert(entityClass);
}
static QueryBuilder delete(String from) {
return QueryBuilder.delete(from);
}
static QueryBuilder delete(Class from) {
return QueryBuilder.delete(from);
}
static Query select(String tableName, UUID id) {
return Query.select(tableName).allColumns().where(id).build();
}
static Query select(Class entityClass, UUID id) {
return Query.select(entityClass).allColumns().where(id).build();
}
static Query insert(T entity) {
return QueryBuilder.insert(entity);
}
static Query update(T entity) {
return QueryBuilder.update(entity);
}
static Query delete(T entity) {
return QueryBuilder.delete(entity);
}
}