new ConversationQuery(client)
Create a ConversationQuery
Parameters:
Name | Type | Description |
---|---|---|
client |
IMClient |
Methods
-
static and(…queries) → {ConversationQuery}
-
构造一个用 AND 连接所有查询的 ConversationQuery
Parameters:
Name Type Attributes Description queries
ConversationQuery <repeatable>
Returns:
ConversationQuery -
static or(…queries) → {ConversationQuery}
-
构造一个用 OR 连接所有查询的 ConversationQuery
Parameters:
Name Type Attributes Description queries
ConversationQuery <repeatable>
Returns:
ConversationQuery -
addAscending(key) → {ConversationQuery}
-
设置返回集合按照指定key进行增序排列,如果已设置其他排序,原排序的优先级较高
Parameters:
Name Type Description key
string Returns:
ConversationQuery - self -
addDescending(key) → {ConversationQuery}
-
设置返回集合按照指定 key 进行降序排列,如果已设置其他排序,原排序的优先级较高
Parameters:
Name Type Description key
string Returns:
ConversationQuery - self -
ascending(key) → {ConversationQuery}
-
设置返回集合按照指定key进行增序排列
Parameters:
Name Type Description key
string Returns:
ConversationQuery - self -
compact(enabledopt) → {ConversationQuery}
-
设置返回的 conversations 为精简模式,即不含成员列表
Parameters:
Name Type Attributes Default Description enabled
Boolean <optional>
true Returns:
ConversationQuery - self -
containedIn(key, values) → {ConversationQuery}
-
增加查询条件,当 conversation 的属性中对应的字段对应的值包含在指定值中时即可返回
Parameters:
Name Type Description key
string values
Returns:
ConversationQuery - self -
contains(key, subString) → {ConversationQuery}
-
增加查询条件,当 conversation 的属性中对应的字段对应的值包含此字符串即可返回
Parameters:
Name Type Description key
string subString
string Returns:
ConversationQuery - self -
containsAll(key, values) → {ConversationQuery}
-
增加查询条件,当conversation的属性中对应的字段中的元素包含所有的值才可返回
Parameters:
Name Type Description key
string values
Returns:
ConversationQuery - self -
containsMembers(peerIds) → {ConversationQuery}
-
增加查询条件,指定聊天室的组员包含某些成员即可返回
Parameters:
Name Type Description peerIds
Array.<string> 成员 ID 列表 Returns:
ConversationQuery - self -
descending(key) → {ConversationQuery}
-
设置返回集合按照指定 key 进行降序排列
Parameters:
Name Type Description key
string Returns:
ConversationQuery - self -
doesNotExist(key) → {ConversationQuery}
-
增加查询条件,当 conversation 不存在指定的字段时即可返回
Parameters:
Name Type Description key
string Returns:
ConversationQuery - self- Since:
- 3.5.0
-
endsWith(key, suffix) → {ConversationQuery}
-
增加查询条件,当 conversation 的属性中对应的字段对应的值以此字符串结束即可返回
Parameters:
Name Type Description key
string suffix
string Returns:
ConversationQuery - self -
equalTo(key, value) → {ConversationQuery}
-
增加查询条件,当 conversation 的属性中对应的字段满足等于条件时即可返回
Parameters:
Name Type Description key
string value
Returns:
ConversationQuery - self -
exists(key) → {ConversationQuery}
-
增加查询条件,当 conversation 存在指定的字段时即可返回
Parameters:
Name Type Description key
string Returns:
ConversationQuery - self- Since:
- 3.5.0
-
find() → {Promise.<Array.<ConversationBase>>} [async]
-
执行查询
Returns:
Promise.<Array.<ConversationBase>> -
first() → {Promise.<ConversationBase>} [async]
-
返回符合条件的第一个结果
Returns:
Promise.<ConversationBase> -
greaterThan(key, value) → {ConversationQuery}
-
增加查询条件,当 conversation 的属性中对应的字段满足大于条件时即可返回
Parameters:
Name Type Description key
string value
Returns:
ConversationQuery - self -
greaterThanOrEqualTo(key, value) → {ConversationQuery}
-
增加查询条件,当 conversation 的属性中对应的字段满足大于等于条件时即可返回
Parameters:
Name Type Description key
string value
Returns:
ConversationQuery - self -
lessThan(key, value) → {ConversationQuery}
-
增加查询条件,当 conversation 的属性中对应的字段满足小于条件时即可返回
Parameters:
Name Type Description key
string value
Returns:
ConversationQuery - self -
lessThanOrEqualTo(key, value) → {ConversationQuery}
-
增加查询条件,当 conversation 的属性中对应的字段满足小于等于条件时即可返回
Parameters:
Name Type Description key
string value
Returns:
ConversationQuery - self -
limit(limit) → {ConversationQuery}
-
设置返回集合的大小上限
Parameters:
Name Type Description limit
Number 上限 Returns:
ConversationQuery - self -
matches(key, regex) → {ConversationQuery}
-
增加查询条件,当 conversation 的属性中对应的字段对应的值满足提供的正则表达式即可返回
Parameters:
Name Type Description key
string regex
RegExp Returns:
ConversationQuery - self -
notContainsIn(key, values) → {ConversationQuery}
-
增加查询条件,当 conversation 的属性中对应的字段对应的值不包含在指定值中时即可返回
Parameters:
Name Type Description key
string values
Returns:
ConversationQuery - self -
notEqualTo(key, value) → {ConversationQuery}
-
增加查询条件,当 conversation 的属性中对应的字段满足不等于条件时即可返回
Parameters:
Name Type Description key
string value
Returns:
ConversationQuery - self -
sizeEqualTo(key, length) → {ConversationQuery}
-
添加查询约束条件,查找 key 类型是数组,该数组的长度匹配提供的数值
Parameters:
Name Type Description key
string length
Number Returns:
ConversationQuery - self -
skip(skip) → {ConversationQuery}
-
设置返回集合的起始位置,一般用于分页
Parameters:
Name Type Description skip
Number 起始位置跳过几个对象 Returns:
ConversationQuery - self -
startsWith(key, prefix) → {ConversationQuery}
-
增加查询条件,当 conversation 的属性中对应的字段对应的值以此字符串起始即可返回
Parameters:
Name Type Description key
string prefix
string Returns:
ConversationQuery - self -
withLastMessagesRefreshed(enabledopt) → {ConversationQuery}
-
设置返回的 conversations 刷新最后一条消息
Parameters:
Name Type Attributes Default Description enabled
Boolean <optional>
true Returns:
ConversationQuery - self -
withMembers(peerIds, includeSelf) → {ConversationQuery}
-
增加查询条件,指定聊天室的组员条件满足条件的才返回
Parameters:
Name Type Description peerIds
Array.<string> 成员 ID 列表 includeSelf
Boolean 是否包含自己 Returns:
ConversationQuery - self