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

ch.epfl.labos.iu.orm.QueryComposer Maven / Gradle / Ivy

package ch.epfl.labos.iu.orm;

import java.util.Iterator;
import java.util.function.Consumer;

import org.jinq.orm.stream.JinqStream;
import org.jinq.orm.stream.JinqStream.AggregateGroup;
import org.jinq.orm.stream.JinqStream.Select;
import org.jinq.tuples.Pair;
import org.jinq.tuples.Tuple;

public interface QueryComposer
{
   public String getDebugQueryString();
   
   // Actually executes the query and returns the results in an iterator
   public Iterator executeAndReturnResultIterator(Consumer exceptionReporter);
   
   // Returns a new query with the given operation integrated in
   // (or returns null if the given operation cannot be integrated)
   public QueryComposer with(T toAdd);
   public > QueryComposer sortedBy(
         JinqStream.CollectComparable sorter, boolean isAscending);
   public QueryComposer limit(long n);
   public QueryComposer skip(long n);
   
   // New stuff for Queryll2
   public  QueryComposer where(JinqStream.Where test);
   public  QueryComposer select(JinqStream.Select select);
   public  QueryComposer> join(JinqStream.Join join);
   public  QueryComposer> join(JinqStream.JoinWithSource join);
   public QueryComposer unique();
//   public  QueryComposer> group(JinqStream.Select select, JinqStream.AggregateGroup aggregate);

   // returns null if the aggregates cannot be calculated
   public Long count();
   public > Number sum(JinqStream.CollectNumber aggregate, Class collectClass);
   public > V max(JinqStream.CollectComparable aggregate);
   public > V min(JinqStream.CollectComparable aggregate);
   public > Double avg(JinqStream.CollectNumber aggregate);
//   public  U selectAggregates(JinqStream.AggregateSelect aggregate);
   
   public  U multiaggregate(JinqStream.AggregateSelect[] aggregates);
   public  QueryComposer groupToTuple(Select select, JinqStream.AggregateGroup[] aggregates);

   public void setHint(String name, Object val);

}