我有一个任意MongoDB JSON查找查询字符串,例如:
{ "address.city": "Seattle"}
Run Code Online (Sandbox Code Playgroud)
要么
{ qty: { $gt: 5, $lt: 50 }
Run Code Online (Sandbox Code Playgroud)
是否有任何现有方法从JSON字符串创建Doctrine.MongoDB.Query对象?或者直接查询mongo然后将这些结果传递给学说进行补水?
谁能解释为什么这些方法会产生两个不同的输出值?从 md5 文档中不清楚。
import (
"crypto/md5"
"encoding/hex"
"fmt"
)
func GetMD5HashWithWrite(text string) string {
hasher := md5.New()
hasher.Write([]byte(text))
return hex.EncodeToString(hasher.Sum(nil))
}
func GetMD5HashWithSum(text string) string {
hasher := md5.New()
return hex.EncodeToString(hasher.Sum([]byte(text)))
}
Run Code Online (Sandbox Code Playgroud)