* QueryCompositionalCondition.cs: chore

* QueryEqualCondition.cs:
* QueryOperationCondition.cs:
oneRain 2019-09-17 16:31:08 +08:00
parent bd47c2e44e
commit 1823dd974b
3 changed files with 13 additions and 19 deletions

View File

@ -222,11 +222,7 @@ namespace LeanCloud.Storage.Internal {
}
public void AddCondition(string key, string op, object value) {
QueryOperationCondition cond = new QueryOperationCondition {
Key = key,
Op = op,
Value = value
};
QueryOperationCondition cond = new QueryOperationCondition(key, op, value);
AddCondition(cond);
}

View File

@ -2,8 +2,8 @@
namespace LeanCloud.Storage.Internal {
internal class QueryEqualCondition : IQueryCondition {
string key;
object value;
readonly string key;
readonly object value;
public QueryEqualCondition(string key, object value) {
this.key = key;

View File

@ -2,29 +2,27 @@
namespace LeanCloud.Storage.Internal {
internal class QueryOperationCondition : IQueryCondition {
public string Key {
get; set;
}
readonly string key;
readonly string op;
readonly object value;
public string Op {
get; set;
}
public object Value {
get; set;
public QueryOperationCondition(string key, string op, object value) {
this.key = key;
this.op = op;
this.value = value;
}
public bool Equals(IQueryCondition other) {
if (other is QueryOperationCondition otherCond) {
return Key == otherCond.Key && Op == otherCond.Op;
return key == otherCond.key && op == otherCond.op;
}
return false;
}
public IDictionary<string, object> ToJSON() {
return new Dictionary<string, object> {
{ Key, new Dictionary<string, object> {
{ Op, Value }
{ key, new Dictionary<string, object> {
{ op, value }
} }
};
}