2020-02-19 18:50:51 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using LeanCloud.Storage.Internal.Codec;
|
|
|
|
|
|
|
|
|
|
namespace LeanCloud.Storage.Internal.Query {
|
2020-03-17 11:41:38 +08:00
|
|
|
|
public class LCOperationCondition : ILCQueryCondition {
|
2020-02-19 18:50:51 +08:00
|
|
|
|
readonly string key;
|
|
|
|
|
readonly string op;
|
|
|
|
|
readonly object value;
|
|
|
|
|
|
2020-03-17 11:41:38 +08:00
|
|
|
|
public LCOperationCondition(string key, string op, object value) {
|
2020-02-19 18:50:51 +08:00
|
|
|
|
this.key = key;
|
|
|
|
|
this.op = op;
|
|
|
|
|
this.value = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Equals(ILCQueryCondition other) {
|
|
|
|
|
if (other is LCOperationCondition cond) {
|
|
|
|
|
return cond.key == key && cond.op == op;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Dictionary<string, object> Encode() {
|
|
|
|
|
return new Dictionary<string, object> {
|
|
|
|
|
{ key, new Dictionary<string, object> {
|
|
|
|
|
{ op, LCEncoder.Encode(value) }
|
|
|
|
|
} }
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|