All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ph.com.nightowlstudios.persistence.query.Query Maven / Gradle / Ivy

There is a newer version: 6.21.1
Show newest version
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);
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy