* AVIMConversationQuery.cs: chore
* Utils.cs: * FileTest.cs: * JsonTest.cs: * JustTest.cs: * RoleTest.cs: * UserTest.cs: * QueryTest.cs: * AVQuery.cs: * ObjectTest.cs: * RelationTest.cs: * SubClassTest.cs: * AppRouterTest.cs: * CloudFunctionTest.cs: * ObjectControllerTests.cs: * AVObjectController.cs:
parent
3f57be22a2
commit
0aab4b959b
|
@ -24,19 +24,7 @@ namespace LeanCloud.Realtime
|
|||
bool compact;
|
||||
bool withLastMessageRefreshed;
|
||||
|
||||
private AVIMConversationQuery(AVIMConversationQuery source,
|
||||
IDictionary<string, object> where = null,
|
||||
IEnumerable<string> replacementOrderBy = null,
|
||||
IEnumerable<string> thenBy = null,
|
||||
int? skip = null,
|
||||
int? limit = null,
|
||||
IEnumerable<string> includes = null,
|
||||
IEnumerable<string> selectedKeys = null,
|
||||
string redirectClassNameForKey = null)
|
||||
: base(source, where, replacementOrderBy, thenBy, skip, limit, includes, selectedKeys, redirectClassNameForKey)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates the instance.
|
||||
|
@ -108,7 +96,7 @@ namespace LeanCloud.Realtime
|
|||
return cmd;
|
||||
}
|
||||
|
||||
public override Task<int> CountAsync(CancellationToken cancellationToken = default) {
|
||||
public Task<int> CountAsync(CancellationToken cancellationToken = default) {
|
||||
var convCmd = GenerateQueryCommand();
|
||||
convCmd.Count();
|
||||
convCmd.Limit(0);
|
||||
|
@ -131,7 +119,7 @@ namespace LeanCloud.Realtime
|
|||
/// </summary>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public override Task<IEnumerable<AVIMConversation>> FindAsync(CancellationToken cancellationToken = default)
|
||||
public Task<IEnumerable<AVIMConversation>> FindAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
var convCmd = this.GenerateQueryCommand().Option("query");
|
||||
return CurrentClient.RunCommandAsync(convCmd).OnSuccess(t =>
|
||||
|
@ -156,12 +144,12 @@ namespace LeanCloud.Realtime
|
|||
});
|
||||
}
|
||||
|
||||
public override Task<AVIMConversation> FirstAsync(CancellationToken cancellationToken = default)
|
||||
public Task<AVIMConversation> FirstAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
return this.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public override Task<AVIMConversation> FirstOrDefaultAsync(CancellationToken cancellationToken = default)
|
||||
public Task<AVIMConversation> FirstOrDefaultAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
var firstQuery = this.Limit(1);
|
||||
return firstQuery.FindAsync().OnSuccess(t =>
|
||||
|
@ -170,7 +158,7 @@ namespace LeanCloud.Realtime
|
|||
});
|
||||
}
|
||||
|
||||
public override Task<AVIMConversation> GetAsync(string objectId, CancellationToken cancellationToken = default)
|
||||
public Task<AVIMConversation> GetAsync(string objectId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var idQuery = this.WhereEqualTo("objectId", objectId);
|
||||
return idQuery.FirstAsync();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
using System.Threading.Tasks;
|
||||
using LeanCloud.Storage.Internal;
|
||||
|
||||
namespace LeanCloudTests {
|
||||
namespace LeanCloud.Test {
|
||||
public class AppRouterTest {
|
||||
[Test]
|
||||
public async Task GetServers() {
|
||||
|
|
|
@ -3,7 +3,7 @@ using LeanCloud;
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LeanCloudTests {
|
||||
namespace LeanCloud.Test {
|
||||
public class CloudFunctionTest {
|
||||
[SetUp]
|
||||
public void SetUp() {
|
||||
|
|
|
@ -4,7 +4,7 @@ using System.IO;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LeanCloudTests {
|
||||
namespace LeanCloud.Test {
|
||||
public class FileTest {
|
||||
string saveFileId;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ using Newtonsoft.Json;
|
|||
using Newtonsoft.Json.Linq;
|
||||
using LeanCloud.Storage.Internal;
|
||||
|
||||
namespace LeanCloudTests {
|
||||
namespace LeanCloud.Test {
|
||||
public class JsonTest {
|
||||
[Test]
|
||||
public void Deserialize() {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
namespace Storage.Test {
|
||||
|
||||
namespace LeanCloud.Test {
|
||||
public class JustTest {
|
||||
public class Animal {
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ using System.Threading.Tasks;
|
|||
using System.Collections.Generic;
|
||||
using LeanCloud;
|
||||
|
||||
namespace LeanCloudTests {
|
||||
namespace LeanCloud.Test {
|
||||
public class ObjectControllerTests {
|
||||
[SetUp]
|
||||
public void SetUp() {
|
||||
|
|
|
@ -3,7 +3,7 @@ using LeanCloud;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LeanCloudTests {
|
||||
namespace LeanCloud.Test {
|
||||
public class ObjectTests {
|
||||
[SetUp]
|
||||
public void SetUp() {
|
||||
|
|
|
@ -3,9 +3,8 @@ using System.Collections.Generic;
|
|||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using LeanCloud;
|
||||
|
||||
namespace LeanCloudTests {
|
||||
namespace LeanCloud.Test {
|
||||
public class QueryTest {
|
||||
[SetUp]
|
||||
public void SetUp() {
|
||||
|
|
|
@ -4,7 +4,7 @@ using System.Threading.Tasks;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace LeanCloudTests {
|
||||
namespace LeanCloud.Test {
|
||||
public class RelationTest {
|
||||
[SetUp]
|
||||
public void SetUp() {
|
||||
|
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||
using System.Threading.Tasks;
|
||||
using LeanCloud;
|
||||
|
||||
namespace LeanCloudTests {
|
||||
namespace LeanCloud.Test {
|
||||
[TestFixture]
|
||||
public class RoleTest {
|
||||
[SetUp]
|
||||
|
|
|
@ -3,7 +3,7 @@ using LeanCloud;
|
|||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LeanCloudTests {
|
||||
namespace LeanCloud.Test {
|
||||
[AVClassName("Account")]
|
||||
public class Account : AVObject {
|
||||
[AVFieldName("name")]
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Linq;
|
|||
using System;
|
||||
using LeanCloud;
|
||||
|
||||
namespace LeanCloudTests {
|
||||
namespace LeanCloud.Test {
|
||||
public class UserTest {
|
||||
[SetUp]
|
||||
public void SetUp() {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
using LeanCloud;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace LeanCloudTests {
|
||||
namespace LeanCloud.Test {
|
||||
public static class Utils {
|
||||
public static void InitNorthChina(bool master = false) {
|
||||
if (master) {
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace LeanCloud.Storage.Internal {
|
|||
args.Add("fetchWhenSave", fetchWhenSave);
|
||||
}
|
||||
// 查询条件
|
||||
if (query != null && query.condition != null) {
|
||||
if (query != null) {
|
||||
args.Add("where", query.BuildWhere());
|
||||
}
|
||||
if (args.Count > 0) {
|
||||
|
|
|
@ -28,7 +28,10 @@ namespace LeanCloud {
|
|||
}
|
||||
}
|
||||
|
||||
internal QueryCompositionalCondition condition;
|
||||
/// <summary>
|
||||
/// 根查询条件,默认是 and 查询,可以设置为 or 查询
|
||||
/// </summary>
|
||||
QueryCompositionalCondition condition;
|
||||
|
||||
static AVQueryController QueryController {
|
||||
get {
|
||||
|
@ -48,7 +51,7 @@ namespace LeanCloud {
|
|||
condition = new QueryCompositionalCondition();
|
||||
}
|
||||
|
||||
#region Composition
|
||||
#region Compositional Query
|
||||
|
||||
public static AVQuery<T> And(IEnumerable<AVQuery<T>> queries) {
|
||||
AVQuery<T> composition = new AVQuery<T>();
|
||||
|
@ -123,6 +126,7 @@ namespace LeanCloud {
|
|||
}
|
||||
|
||||
#region CQL
|
||||
|
||||
/// <summary>
|
||||
/// 执行 CQL 查询
|
||||
/// </summary>
|
||||
|
@ -166,27 +170,6 @@ namespace LeanCloud {
|
|||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified object is equal to the current object.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to compare with the current object.</param>
|
||||
/// <returns><c>true</c> if the specified object is equal to the current object; otherwise, <c>false</c></returns>
|
||||
public override bool Equals(object obj) {
|
||||
if (obj == null || !(obj is AVQuery<T>)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var other = obj as AVQuery<T>;
|
||||
return ClassName.Equals(other.ClassName) &&
|
||||
condition.Equals(other.condition);
|
||||
}
|
||||
|
||||
public override int GetHashCode() {
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
#region Order By
|
||||
|
||||
public AVQuery<T> OrderBy(string key) {
|
||||
condition.OrderBy(key);
|
||||
return this;
|
||||
|
@ -197,8 +180,6 @@ namespace LeanCloud {
|
|||
return this;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public AVQuery<T> Include(string key) {
|
||||
condition.Include(key);
|
||||
return this;
|
||||
|
@ -355,7 +336,7 @@ namespace LeanCloud {
|
|||
|
||||
#endregion
|
||||
|
||||
internal IDictionary<string, object> BuildParameters(string className = null) {
|
||||
public IDictionary<string, object> BuildParameters(string className = null) {
|
||||
return condition.BuildParameters(className);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue