当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Query.equalTo方法代码示例

本文整理汇总了TypeScript中avoscloud-sdk.Query.equalTo方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Query.equalTo方法的具体用法?TypeScript Query.equalTo怎么用?TypeScript Query.equalTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在avoscloud-sdk.Query的用法示例。


在下文中一共展示了Query.equalTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: test_query

function test_query() {

    var TestObject = AV.Object.extend('TestObject')
    var todoObject = new TestObject();

    var query = new AV.Query(TestObject);

    query.equalTo("testString", "leancloud");
    query.notEqualTo("testString", "aws");
    query.greaterThan("testInteger", 150);
    query.limit(10);
    query.skip(10);

    // Sorts the results in ascending order by the score field
    query.ascending("testString");

    // Sorts the results in descending order by the score field
    query.descending("testString");

    // Restricts to wins < 50
    query.lessThan("testInteger", 50);

    // Restricts to wins <= 50
    query.lessThanOrEqualTo("testInteger", 50);

    // Restricts to wins > 50
    query.greaterThan("testInteger", 50);

    // Restricts to wins >= 50
    query.greaterThanOrEqualTo("testInteger", 50);

    // Finds scores from any of Jonathan, Dario, or Shawn
    query.containedIn("testString",
                      ["leancloud", "aws", "azure"]);

    // Finds scores from anyone who is neither Jonathan, Dario, nor Shawn
    query.notContainedIn("testString",
                         ["leancloud", "aws", "azure"]);

    // Finds objects that have the score set
    query.exists("testInteger");

    // Finds objects that don't have the score set
    query.doesNotExist("testInteger");

    query.select("testInteger", "leancloud");

    // Find objects where the array in arrayKey contains 2.
    query.equalTo("arrayKey", 2);

    // Find objects where the array in arrayKey contains all of the elements 2, 3, and 4.
    query.containsAll("arrayKey", [2, 3, 4]);

    query.startsWith("testString", "l");
}
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:55,代码来源:avoscloud-sdk-tests.ts

示例2: test_push

function test_push() {

    AV.Push.send({
        channels: [ "Gia nts", "Mets" ],
        data: {
            alert: "The Giants won against the Mets 2-3."
        }
    }, {
        success: () => {
            // Push was successful
        },
        error: (error: any) => {
            // Handle error
        }
    });

    var query = new AV.Query(AV.Installation);
    query.equalTo('injuryReports', true);

    AV.Push.send({
        where: query, // Set our Installation query
        data: {
            alert: "Willie Hayes injured by own pop fly."
        }
    }, {
        success: function() {
            // Push was successful
        },
        error: function(error: any) {
            // Handle error
        }
    });
}
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:33,代码来源:avoscloud-sdk-tests.ts


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