csharp-sdk-upm/Storage/Internal/Query/LCEqualCondition.cs

28 lines
753 B
C#
Raw Normal View History

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