Java 类com.datastax.driver.core.querybuilder.Ordering 实例源码

项目:bifroest    文件:CassandraDatabase.java   
public Iterable<Metric> loadMetrics( RetentionTable table, String name, Interval interval ) {
    if ( session == null ) {
        open();
    }
    Clause cName = QueryBuilder.eq( COL_NAME, name );
    Ordering order = QueryBuilder.desc( COL_TIME );
    // start inclusive, end exclusive
    Clause cBtm = QueryBuilder.gte( COL_TIME, interval.start() );
    Clause cTop = QueryBuilder.lt( COL_TIME, interval.end() );
    Statement stm = QueryBuilder.select().all().from( table.tableName() ).where( cName ).and( cBtm ).and( cTop ).orderBy( order );
    final Iterator<Row> iter = session.execute( stm ).iterator();
    return new Iterable<Metric>() {

        @Override
        public Iterator<Metric> iterator() {
            return new Iterator<Metric>() {

                @Override
                public boolean hasNext() {
                    return iter.hasNext();
                }

                @Override
                public Metric next() {
                    Row row = iter.next();
                    return new Metric( row.getString( COL_NAME ), row.getLong( COL_TIME ), row.getDouble( COL_VALUE ) );
                }

                @Override
                public void remove() {
                    throw new UnsupportedOperationException();
                }
            };
        }
    };
}
项目:iotplatform    文件:CassandraAbstractSearchTimeDao.java   
protected List<E> findPageWithTimeSearch(String searchView, List<Clause> clauses, Ordering ordering, TimePageLink pageLink) {
    return findPageWithTimeSearch(searchView, clauses, Collections.singletonList(ordering), pageLink);
}
项目:iotplatform    文件:CassandraAbstractSearchTimeDao.java   
protected List<E> findPageWithTimeSearch(String searchView, List<Clause> clauses, List<Ordering> topLevelOrderings, TimePageLink pageLink) {
    return findPageWithTimeSearch(searchView, clauses, topLevelOrderings, pageLink, ModelConstants.ID_PROPERTY);
}
项目:iotplatform    文件:CassandraAbstractSearchTimeDao.java   
protected List<E> findPageWithTimeSearch(String searchView, List<Clause> clauses, List<Ordering> topLevelOrderings, TimePageLink pageLink, String idColumn) {
    return findListByStatement(buildQuery(searchView, clauses, topLevelOrderings, pageLink, idColumn));
}
项目:iotplatform    文件:CassandraAbstractSearchTimeDao.java   
public static Where buildQuery(String searchView, List<Clause> clauses, Ordering order, TimePageLink pageLink, String idColumn) {
    return buildQuery(searchView, clauses, Collections.singletonList(order), pageLink, idColumn);
}
项目:thingsboard    文件:CassandraAbstractSearchTimeDao.java   
protected List<E> findPageWithTimeSearch(String searchView, List<Clause> clauses, Ordering ordering, TimePageLink pageLink) {
    return findPageWithTimeSearch(searchView, clauses, Collections.singletonList(ordering), pageLink);
}
项目:thingsboard    文件:CassandraAbstractSearchTimeDao.java   
protected List<E> findPageWithTimeSearch(String searchView, List<Clause> clauses, List<Ordering> topLevelOrderings, TimePageLink pageLink) {
    return findPageWithTimeSearch(searchView, clauses, topLevelOrderings, pageLink, ModelConstants.ID_PROPERTY);
}
项目:thingsboard    文件:CassandraAbstractSearchTimeDao.java   
protected List<E> findPageWithTimeSearch(String searchView, List<Clause> clauses, List<Ordering> topLevelOrderings, TimePageLink pageLink, String idColumn) {
    return findListByStatement(buildQuery(searchView, clauses, topLevelOrderings, pageLink, idColumn));
}
项目:thingsboard    文件:CassandraAbstractSearchTimeDao.java   
public static Where buildQuery(String searchView, List<Clause> clauses, Ordering order, TimePageLink pageLink, String idColumn) {
    return buildQuery(searchView, clauses, Collections.singletonList(order), pageLink, idColumn);
}