AVIMConversationQuery Class Reference

Inherits from NSObject
Declared in AVIMConversationQuery.h

Overview

< 返回对话最近一条消息

  limit

限制结果数量

@property (nonatomic, assign) NSInteger limit

Discussion

限制结果数量

Declared In

AVIMConversationQuery.h

  skip

返回此位置开始的结果

@property (nonatomic, assign) NSInteger skip

Discussion

返回此位置开始的结果

Declared In

AVIMConversationQuery.h

  cachePolicy

设置缓存策略,默认是 kAVCachePolicyCacheElseNetwork

@property (nonatomic, assign) AVIMCachePolicy cachePolicy

Discussion

设置缓存策略,默认是 kAVCachePolicyCacheElseNetwork

Declared In

AVIMConversationQuery.h

  cacheMaxAge

设置缓存的过期时间,默认是 1 小时(1 * 60 * 60)

@property (nonatomic, assign) NSTimeInterval cacheMaxAge

Discussion

设置缓存的过期时间,默认是 1 小时(1 * 60 * 60)

Declared In

AVIMConversationQuery.h

  option

查询条件

@property (nonatomic, assign) AVIMConversationQueryOption option

Discussion

查询条件

Declared In

AVIMConversationQuery.h

+ orQueryWithSubqueries:

Build an query that is the OR of the passed in queries.

+ (instancetype)orQueryWithSubqueries:(NSArray<AVIMConversationQuery*> *)queries

Parameters

queries

The list of queries to OR together.

Return Value

an query that is the OR of the passed in queries.

Discussion

Build an query that is the OR of the passed in queries.

Declared In

AVIMConversationQuery.h

+ andQueryWithSubqueries:

Build an query that is the AND of the passed in queries.

+ (instancetype)andQueryWithSubqueries:(NSArray<AVIMConversationQuery*> *)queries

Parameters

queries

The list of queries to AND together.

Return Value

an query that is the AND of the passed in queries.

Discussion

Build an query that is the AND of the passed in queries.

Declared In

AVIMConversationQuery.h

– whereKeyExists:

Add a constraint that requires a particular key exists.

- (void)whereKeyExists:(NSString *)key

Parameters

key

The key that should exist.

Discussion

Add a constraint that requires a particular key exists.

Declared In

AVIMConversationQuery.h

– whereKeyDoesNotExist:

Add a constraint that requires a key not exist.

- (void)whereKeyDoesNotExist:(NSString *)key

Parameters

key

The key that should not exist.

Discussion

Add a constraint that requires a key not exist.

Declared In

AVIMConversationQuery.h

– whereKey:equalTo:

添加等于条件

- (void)whereKey:(NSString *)key equalTo:(id)object

Parameters

key

添加条件的 key

object

需要等于的 object

Discussion

添加等于条件

Declared In

AVIMConversationQuery.h

– whereKey:lessThan:

添加小于条件

- (void)whereKey:(NSString *)key lessThan:(id)object

Parameters

key

添加条件的 key

object

需要小于的 object

Discussion

添加小于条件

Declared In

AVIMConversationQuery.h

– whereKey:lessThanOrEqualTo:

添加小于或等于条件

- (void)whereKey:(NSString *)key lessThanOrEqualTo:(id)object

Parameters

key

添加条件的 key

object

需要小于或等于的 object

Discussion

添加小于或等于条件

Declared In

AVIMConversationQuery.h

– whereKey:greaterThan:

添加大于条件

- (void)whereKey:(NSString *)key greaterThan:(id)object

Parameters

key

添加条件的 key

object

需要大于的 object

Discussion

添加大于条件

Declared In

AVIMConversationQuery.h

– whereKey:greaterThanOrEqualTo:

添加大于或等于条件

- (void)whereKey:(NSString *)key greaterThanOrEqualTo:(id)object

Parameters

key

添加条件的 key

object

需要大于或等于的 object

Discussion

添加大于或等于条件

Declared In

AVIMConversationQuery.h

– whereKey:notEqualTo:

添加不等于条件

- (void)whereKey:(NSString *)key notEqualTo:(id)object

Parameters

key

添加条件的 key

object

需要不等于的 object

Discussion

添加不等于条件

Declared In

AVIMConversationQuery.h

– whereKey:containedIn:

添加被包含条件

- (void)whereKey:(NSString *)key containedIn:(NSArray *)array

Parameters

key

添加条件的 key

array

key 对应的值被 array 包含

Discussion

添加被包含条件

Declared In

AVIMConversationQuery.h

– whereKey:notContainedIn:

添加不被包含条件

- (void)whereKey:(NSString *)key notContainedIn:(NSArray *)array

Parameters

key

添加条件的 key

array

key 对应的值不被 array 包含

Discussion

添加不被包含条件

Declared In

AVIMConversationQuery.h

– whereKey:containsAllObjectsInArray:

添加包含条件

- (void)whereKey:(NSString *)key containsAllObjectsInArray:(NSArray *)array

Parameters

key

添加条件的 key

array

key 对应的值包含 array 里所有对象

Discussion

添加包含条件

Declared In

AVIMConversationQuery.h

– whereKey:nearGeoPoint:

添加位置条件,结果将按与参考点位置的距离由近到远排序

- (void)whereKey:(NSString *)key nearGeoPoint:(AVGeoPoint *)geopoint

Parameters

key

添加条件的 key

geopoint

参考点位置

Discussion

添加位置条件,结果将按与参考点位置的距离由近到远排序

Declared In

AVIMConversationQuery.h

– whereKey:nearGeoPoint:withinMiles:

添加位置条件,结果将按与参考点位置的距离由近到远排序

- (void)whereKey:(NSString *)key nearGeoPoint:(AVGeoPoint *)geopoint withinMiles:(double)maxDistance

Parameters

key

添加条件的 key

geopoint

参考点位置

maxDistance

最大距离,单位英里

Discussion

添加位置条件,结果将按与参考点位置的距离由近到远排序

Declared In

AVIMConversationQuery.h

– whereKey:nearGeoPoint:withinKilometers:

添加位置条件,结果将按与参考点位置的距离由近到远排序

- (void)whereKey:(NSString *)key nearGeoPoint:(AVGeoPoint *)geopoint withinKilometers:(double)maxDistance

Parameters

key

添加条件的 key

geopoint

参考点位置

maxDistance

最大距离,单位千米

Discussion

添加位置条件,结果将按与参考点位置的距离由近到远排序

Declared In

AVIMConversationQuery.h

– whereKey:nearGeoPoint:withinRadians:

添加位置条件,结果将按与参考点位置的距离由近到远排序

- (void)whereKey:(NSString *)key nearGeoPoint:(AVGeoPoint *)geopoint withinRadians:(double)maxDistance

Parameters

key

添加条件的 key

geopoint

参考点位置

maxDistance

最大距离,单位弧度

Discussion

添加位置条件,结果将按与参考点位置的距离由近到远排序

Declared In

AVIMConversationQuery.h

– whereKey:withinGeoBoxFromSouthwest:toNortheast:

添加位置条件,获取位置在 southwest 和 northeast 构成的方形区域的所有记录

- (void)whereKey:(NSString *)key withinGeoBoxFromSouthwest:(AVGeoPoint *)southwest toNortheast:(AVGeoPoint *)northeast

Parameters

key

添加条件的 key

southwest

区域的左下角位置

northeast

区域的右上角位置

Discussion

添加位置条件,获取位置在 southwest 和 northeast 构成的方形区域的所有记录

Declared In

AVIMConversationQuery.h

– whereKey:matchesRegex:

添加正则条件,此条件可能影响性能

- (void)whereKey:(NSString *)key matchesRegex:(NSString *)regex

Parameters

key

添加条件的 key

regex

需要匹配的正则

Discussion

添加正则条件,此条件可能影响性能

Declared In

AVIMConversationQuery.h

– whereKey:matchesRegex:modifiers:

添加正则条件,此条件可能影响性能

- (void)whereKey:(NSString *)key matchesRegex:(NSString *)regex modifiers:(nullable NSString *)modifiers

Parameters

key

添加条件的 key

regex

需要匹配的正则

modifiers

支持 PCRE 修饰:
i - 忽略大小写
m - 跨行匹配

Discussion

添加正则条件,此条件可能影响性能

Declared In

AVIMConversationQuery.h

– whereKey:containsString:

添加字符串包含条件

- (void)whereKey:(NSString *)key containsString:(NSString *)substring

Parameters

key

添加条件的 key

substring

需要包含的字符串

Discussion

添加字符串包含条件

Declared In

AVIMConversationQuery.h

– whereKey:hasPrefix:

添加字符串前缀匹配条件

- (void)whereKey:(NSString *)key hasPrefix:(NSString *)prefix

Parameters

key

添加条件的 key

prefix

需要匹配的前缀

Discussion

添加字符串前缀匹配条件

Declared In

AVIMConversationQuery.h

– whereKey:hasSuffix:

添加字符串后缀匹配条件

- (void)whereKey:(NSString *)key hasSuffix:(NSString *)suffix

Parameters

key

添加条件的 key

suffix

需要匹配的后缀

Discussion

添加字符串后缀匹配条件

Declared In

AVIMConversationQuery.h

– whereKey:sizeEqualTo:

添加数组元素数量匹配条件

- (void)whereKey:(NSString *)key sizeEqualTo:(NSUInteger)count

Parameters

key

添加条件的 key

count

需要匹配的数组元素数量

Discussion

添加数组元素数量匹配条件

Declared In

AVIMConversationQuery.h

– orderByAscending:

升序排序

- (void)orderByAscending:(NSString *)key

Parameters

key

升序的 key

Discussion

升序排序

Declared In

AVIMConversationQuery.h

– addAscendingOrder:

添加升序排序

- (void)addAscendingOrder:(NSString *)key

Parameters

key

升序的 key

Discussion

添加升序排序

Declared In

AVIMConversationQuery.h

– orderByDescending:

降序排序

- (void)orderByDescending:(NSString *)key

Parameters

key

降序的 key

Discussion

降序排序

Declared In

AVIMConversationQuery.h

– addDescendingOrder:

添加降序排序

- (void)addDescendingOrder:(NSString *)key

Parameters

key

降序的 key

Discussion

添加降序排序

Declared In

AVIMConversationQuery.h

– orderBySortDescriptor:

使用 sortDescriptor 排序

- (void)orderBySortDescriptor:(NSSortDescriptor *)sortDescriptor

Parameters

sortDescriptor

NSSortDescriptor 对象

Discussion

使用 sortDescriptor 排序

Declared In

AVIMConversationQuery.h

– orderBySortDescriptors:

使用 sortDescriptors 排序

- (void)orderBySortDescriptors:(NSArray *)sortDescriptors

Parameters

sortDescriptors

NSSortDescriptor 对象数组

Discussion

使用 sortDescriptors 排序

Declared In

AVIMConversationQuery.h

– getConversationById:callback:

通过 conversationId 查询服务器,获取一个 AVIMConversation 对象

- (void)getConversationById:(NSString *)conversationId callback:(void ( ^ ) ( AVIMConversation *_Nullable conversation , NSError *_Nullable error ))callback

Parameters

conversationId

查询使用的对话 id

callback

查询结果回调

Discussion

通过 conversationId 查询服务器,获取一个 AVIMConversation 对象

Declared In

AVIMConversationQuery.h

– findConversationsWithCallback:

查询服务器获取一个 AVIMConversation 对象数组 如果未设置 limit,或 limit 非法,默认返回 10 个结果

- (void)findConversationsWithCallback:(void ( ^ ) ( NSArray<AVIMConversation*> *_Nullable conversations , NSError *_Nullable error ))callback

Parameters

callback

查询结果回调

Discussion

查询服务器获取一个 AVIMConversation 对象数组 如果未设置 limit,或 limit 非法,默认返回 10 个结果

Declared In

AVIMConversationQuery.h

– findTemporaryConversationsWith:callback:

Query array of AVIMTemporaryConversation info. if not set limit, or limit invalid, return 10 or less in default.

- (void)findTemporaryConversationsWith:(NSArray<NSString*> *)tempConvIds callback:(void ( ^ ) ( NSArray<AVIMTemporaryConversation*> *_Nullable conversations , NSError *_Nullable error ))callback

Parameters

tempConvIds

Array of queried conversation’s id.

callback

Result of callback.

Discussion

Query array of AVIMTemporaryConversation info. if not set limit, or limit invalid, return 10 or less in default.

Declared In

AVIMConversationQuery.h