• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java QueryValve类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.jcabi.dynamo.QueryValve的典型用法代码示例。如果您正苦于以下问题:Java QueryValve类的具体用法?Java QueryValve怎么用?Java QueryValve使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



QueryValve类属于com.jcabi.dynamo包,在下文中一共展示了QueryValve类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: details

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
@Override
public Iterable<Directive> details(final long time) throws IOException {
    final Iterator<Item> items = this.table()
        .frame()
        .through(
            new QueryValve()
                .withSelect(Select.ALL_ATTRIBUTES)
                .withLimit(1)
        )
        .where("url", Conditions.equalTo(this.url))
        .where("time", Conditions.equalTo(time))
        .iterator();
    if (!items.hasNext()) {
        throw new IllegalArgumentException(
            String.format(
                "Request at %d for %s not found",
                time, this.url
            )
        );
    }
    return DyStatus.xembly(items.next(), true);
}
 
开发者ID:yegor256,项目名称:rehttp,代码行数:23,代码来源:DyStatus.java


示例2: expired

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
@Override
public Iterable<Take> expired() {
    return new Mapped<>(
        this.table()
            .frame()
            .through(
                new QueryValve()
                    .withIndexName("expired")
                    .withConsistentRead(false)
                    .withSelect(Select.ALL_ATTRIBUTES)
            )
            .where("success", Conditions.equalTo(Boolean.toString(false)))
            .where(
                "when",
                new Condition()
                    .withComparisonOperator(ComparisonOperator.LT)
                    .withAttributeValueList(
                        new AttributeValue().withN(
                            Long.toString(System.currentTimeMillis())
                        )
                    )
            ),
        item -> new DyTake(item, this.delay)
    );
}
 
开发者ID:yegor256,项目名称:rehttp,代码行数:26,代码来源:DyBase.java


示例3: scripts

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
@Override
public Iterable<Iterable<Directive>> scripts() {
    return new Mapped<Item, Iterable<Directive>>(
        item -> new Directives()
            .add("script")
            .add("name").set(item.get("name").getS()).up()
            .add("bash").set(item.get("bash").getS()).up()
            .add("paid").set(item.get("paid").getN()).up()
            .add("used").set(item.get("used").getN()).up()
            .add("hour").set(item.get("hour").getN()).up()
            .add("day").set(item.get("day").getN()).up()
            .add("week").set(item.get("week").getN()).up()
            .up(),
        this.region.table("scripts")
            .frame()
            .through(
                new QueryValve()
                    // @checkstyle MagicNumber (1 line)
                    .withLimit(10)
                    .withSelect(Select.ALL_ATTRIBUTES)
            )
            .where("login", this.login)
        );
}
 
开发者ID:yegor256,项目名称:threecopies,代码行数:25,代码来源:DyUser.java


示例4: logs

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
@Override
public Iterable<Iterable<Directive>> logs() {
    return new Mapped<Item, Iterable<Directive>>(
        item -> new Directives()
            .add("log")
            .add("group").set(item.get("group").getS()).up()
            .add("start").set(item.get("start").getN()).up()
            .add("finish").set(item.get("finish").getN()).up()
            .add("period").set(item.get("period").getS()).up()
            .add("ocket").set(item.get("ocket").getS()).up()
            .add("exit").set(item.get("exit").getN()).up()
            .up(),
        this.region.table("logs")
            .frame()
            .through(
                new QueryValve()
                    .withIndexName("mine")
                    // @checkstyle MagicNumber (1 line)
                    .withLimit(20)
                    .withConsistentRead(false)
                    .withScanIndexForward(false)
                    .withSelect(Select.ALL_ATTRIBUTES)
            )
            .where("login", this.login)
    );
}
 
开发者ID:yegor256,项目名称:threecopies,代码行数:27,代码来源:DyUser.java


示例5: ocket

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
@Override
public String ocket(final long time) throws IOException {
    final Iterator<Item> items = this.region.table("logs")
        .frame()
        .through(new QueryValve().withLimit(1))
        .where("group", this.group())
        .where(
            "start",
            new Condition()
                .withComparisonOperator(ComparisonOperator.EQ)
                .withAttributeValueList(
                    new AttributeValue().withN(Long.toString(time))
                )
        )
        .iterator();
    if (!items.hasNext()) {
        throw new RsForward(
            new RsFlash("Can't find log"),
            "/scripts"
        );
    }
    return items.next().get("ocket").getS();
}
 
开发者ID:yegor256,项目名称:threecopies,代码行数:24,代码来源:DyScript.java


示例6: recent

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
/**
 * Recent artifacts..
 * @return List of them
 */
public Iterable<Iterable<Directive>> recent() {
    return new Mapped<>(
        item -> {
            final String[] parts = item.get("artifact").getS().split(":");
            return new Directives()
                .add("repo")
                .add("group").set(parts[0]).up()
                .add("artifact").set(parts[1]).up()
                .up();
        },
        this.table.frame()
            .where("good", "true")
            .through(
                new QueryValve()
                    .withScanIndexForward(false)
                    .withIndexName("recent")
                    .withConsistentRead(false)
                    // @checkstyle MagicNumber (1 line)
                    .withLimit(25)
                    .withAttributesToGet("artifact")
            )
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:28,代码来源:Results.java


示例7: mine

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
@Override
public Iterable<Domain> mine() {
    return this.table()
        .frame()
        .through(
            new QueryValve()
                .withSelect(Select.ALL_ATTRIBUTES)
                .withLimit(Tv.HUNDRED)
                .withConsistentRead(false)
                .withIndexName("mine")
        )
        .where("user", Conditions.equalTo(this.handle))
        .stream()
        .map(DyDomain::new)
        .map(Domain.class::cast)
        .collect(Collectors.toList());
}
 
开发者ID:yegor256,项目名称:jare,代码行数:18,代码来源:DyUser.java


示例8: domain

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
@Override
public Iterable<Domain> domain(final String name) {
    return this.table()
        .frame()
        .through(
            new QueryValve()
                .withSelect(Select.ALL_ATTRIBUTES)
                .withLimit(1)
                .withConsistentRead(true)
        )
        .where(
            "domain",
            Conditions.equalTo(name.toLowerCase(Locale.ENGLISH))
        )
        .stream()
        .map(DyDomain::new)
        .map(Domain.class::cast)
        .collect(Collectors.toList());
}
 
开发者ID:yegor256,项目名称:jare,代码行数:20,代码来源:DyBase.java


示例9: iterate

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
@Override
public Iterable<Pipe> iterate() {
    return () -> this.table()
        .frame()
        .through(
            new QueryValve()
                .withSelect(Select.ALL_ATTRIBUTES)
                .withLimit(Tv.HUNDRED)
                .withConsistentRead(true)
        )
        .where("urn", Conditions.equalTo(this.urn))
        .stream()
        .map(DyPipe::new)
        .map(Pipe.class::cast)
        .iterator();
}
 
开发者ID:yegor256,项目名称:wring,代码行数:17,代码来源:DyPipes.java


示例10: iterate

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
@Override
public Iterable<Event> iterate() {
    return () -> this.table()
        .frame()
        .through(
            new QueryValve()
                .withLimit(Tv.TWENTY)
                .withIndexName("top")
                .withSelect(Select.ALL_ATTRIBUTES)
                .withScanIndexForward(false)
                .withConsistentRead(false)
        )
        .where("urn", Conditions.equalTo(this.urn))
        .stream()
        .map(DyEvent::new)
        .map(Event.class::cast)
        .iterator();
}
 
开发者ID:yegor256,项目名称:wring,代码行数:19,代码来源:DyEvents.java


示例11: get

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
@Override
public Deck get(final String name) throws IOException {
    final Iterator<Item> items = this.region
        .table(DyDeck.TBL)
        .frame()
        .through(new QueryValve().withLimit(1))
        .where(DyDeck.HASH, this.user)
        .where(DyDeck.RANGE, name)
        .iterator();
    if (!items.hasNext()) {
        throw new IOException(
            String.format("deck '%s' not found", name)
        );
    }
    return new DyDeck(
        this.region, this.user, name
    );
}
 
开发者ID:yegor256,项目名称:thindeck,代码行数:19,代码来源:DyDecks.java


示例12: delete

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
@Override
public void delete(final String name) {
    final Iterator<Item> items = this.region.table(DyDeck.TBL)
        .frame()
        .through(new QueryValve().withLimit(1))
        .where(DyDeck.HASH, this.user)
        .where(DyDeck.RANGE, name)
        .iterator();
    if (!items.hasNext()) {
        throw new IllegalStateException(
            String.format(
                "deck '%s' not found, can't delete",
                name
            )
        );
    }
    items.next();
    items.remove();
}
 
开发者ID:yegor256,项目名称:thindeck,代码行数:20,代码来源:DyDecks.java


示例13: iterate

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
@Override
public Iterable<Deck> iterate() {
    return Iterables.transform(
        this.region.table(DyDeck.TBL)
            .frame()
            .through(new QueryValve().withSelect(Select.ALL_ATTRIBUTES))
            .where(DyDeck.HASH, this.user),
        new Function<Item, Deck>() {
            @Override
            public Deck apply(final Item input) {
                try {
                    return DyDecks.this.get(input.get(DyDeck.RANGE).getS());
                } catch (final IOException ex) {
                    throw new IllegalStateException(ex);
                }
            }
        }
    );
}
 
开发者ID:yegor256,项目名称:thindeck,代码行数:20,代码来源:DyDecks.java


示例14: item

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
/**
 * Item.
 * @return Item
 */
private Item item() {
    final Iterator<Item> items = this.region
        .table(DyDeck.TBL)
        .frame()
        .through(
            new QueryValve()
                .withSelect(Select.ALL_ATTRIBUTES)
                .withLimit(1)
        )
        .where(DyDeck.HASH, this.user)
        .where(DyDeck.RANGE, this.deck)
        .iterator();
    if (!items.hasNext()) {
        throw new IllegalArgumentException(
            String.format("deck '%s' not found", this.deck)
        );
    }
    return items.next();
}
 
开发者ID:yegor256,项目名称:thindeck,代码行数:24,代码来源:DyDeck.java


示例15: forward

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
/**
 * Forward search.
 * @param left Left
 * @param cnds Conditions
 * @return Rights
 */
public Iterable<String> forward(final String left,
    final Iterable<Condition> cnds) {
    Frame frame = this.region.table(Refs.TABLE)
        .frame()
        .through(new QueryValve().withScanIndexForward(false))
        .where(Refs.HASH, left);
    for (final Condition cnd : cnds) {
        frame = frame.where(Refs.RANGE, cnd);
    }
    return Iterables.transform(
        frame,
        new Function<Item, String>() {
            @Override
            public String apply(final Item input) {
                try {
                    return input.get(Refs.RANGE).getS();
                } catch (final IOException ex) {
                    throw new IllegalStateException(ex);
                }
            }
        }
    );
}
 
开发者ID:yegor256,项目名称:bibrarian,代码行数:30,代码来源:Refs.java


示例16: failures

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
@Override
public Collection<Iterable<Directive>> failures(final long after) {
    return new Mapped<>(
        this.table()
            .frame()
            .through(
                new QueryValve()
                    .withIndexName("failures")
                    .withAttributesToGet(
                        "url", "time", "code", "attempts", "when", "ttl"
                    )
                    .withLimit(Tv.TWENTY)
                    .withConsistentRead(false)
                    .withScanIndexForward(false)
            )
            .where("failed_url", Conditions.equalTo(this.url))
            .where(
                "time",
                new Condition()
                    .withComparisonOperator(ComparisonOperator.LT)
                    .withAttributeValueList(
                        new AttributeValue().withN(
                            Long.toString(after)
                        )
                    )
            ),
        item -> DyStatus.xembly(item, false)
    );
}
 
开发者ID:yegor256,项目名称:rehttp,代码行数:30,代码来源:DyStatus.java


示例17: history

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
@Override
public Collection<Iterable<Directive>> history(final long after) {
    return new Mapped<>(
        this.table()
            .frame()
            .through(
                new QueryValve()
                    .withAttributesToGet(
                        "url", "time", "code", "attempts", "when", "ttl"
                    )
                    .withLimit(Tv.TEN)
                    .withScanIndexForward(false)
            )
            .where("url", Conditions.equalTo(this.url))
            .where(
                "time",
                new Condition()
                    .withComparisonOperator(ComparisonOperator.LT)
                    .withAttributeValueList(
                        new AttributeValue().withN(
                            Long.toString(after)
                        )
                    )
            ),
        item -> DyStatus.xembly(item, false)
    );
}
 
开发者ID:yegor256,项目名称:rehttp,代码行数:28,代码来源:DyStatus.java


示例18: target

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
@Override
public Take target(final URL url, final long time) throws IOException {
    final Iterator<Item> items = this.table()
        .frame()
        .through(
            new QueryValve()
                .withSelect(Select.ALL_ATTRIBUTES)
                .withLimit(1)
        )
        .where("url", Conditions.equalTo(url))
        .where("time", Conditions.equalTo(time))
        .iterator();
    final Item item;
    if (items.hasNext()) {
        item = items.next();
    } else {
        item = this.table().put(
            new Attributes()
                .with("url", url)
                .with("time", time)
                .with("code", 0)
                .with("attempts", 0)
                .with("when", System.currentTimeMillis())
                .with(
                    "ttl",
                    (System.currentTimeMillis()
                        + TimeUnit.DAYS.toMillis(1L))
                        / TimeUnit.SECONDS.toMillis(1L)
                )
        );
    }
    return new DyTake(item, this.delay);
}
 
开发者ID:yegor256,项目名称:rehttp,代码行数:34,代码来源:DyBase.java


示例19: worst

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
/**
 * Worst metrics.
 * @return List of them
 * @throws IOException If fails
 */
public Iterable<Iterable<Directive>> worst() throws IOException {
    return new Mapped<>(
        item -> new Directives()
            .add("metric")
            .attr("id", item.get("metric").getS())
            .add("pos").set(item.get("pos").getN()).up()
            .add("neg").set(item.get("neg").getN()).up()
            .add("psum").set(new DyNum(item, "psum").doubleValue()).up()
            .add("pavg").set(new DyNum(item, "pavg").doubleValue()).up()
            .add("nsum").set(new DyNum(item, "nsum").doubleValue()).up()
            .add("navg").set(new DyNum(item, "navg").doubleValue()).up()
            .add("avg").set(new DyNum(item, "avg").doubleValue()).up()
            .add("champions").set(item.get("champions").getN()).up()
            .add("artifact").set(item.get("artifact").getS()).up()
            .add("mean").set(new DyNum(item, "mean").doubleValue()).up()
            .add("sigma").set(new DyNum(item, "sigma").doubleValue()).up()
            .up(),
        this.table.frame()
            .where("version", new Version().value())
            .through(
                new QueryValve()
                    .withScanIndexForward(false)
                    .withIndexName("mistakes")
                    .withConsistentRead(false)
                    // @checkstyle MagicNumber (1 line)
                    .withLimit(20)
                    .withSelect(Select.ALL_ATTRIBUTES)
            )
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:36,代码来源:Mistakes.java


示例20: pipe

import com.jcabi.dynamo.QueryValve; //导入依赖的package包/类
@Override
public Pipe pipe(final long number) {
    final Item item = this.table()
        .frame()
        .through(new QueryValve().withLimit(1).withConsistentRead(true))
        .where("urn", Conditions.equalTo(this.urn))
        .where("id", Conditions.equalTo(number))
        .iterator()
        .next();
    return new DyPipe(item);
}
 
开发者ID:yegor256,项目名称:wring,代码行数:12,代码来源:DyPipes.java



注:本文中的com.jcabi.dynamo.QueryValve类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Join类代码示例发布时间:2022-05-23
下一篇:
Java SiteRendererSink类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap