You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there!
While testing queries, I encountered a panic when passing an int32 value to a query that i found uses ToInt64 function. The function converts only uint64 and int64 types to int64. If an int, int32, or any other type is passed, the function panics with the message “not a number” so i wondered if it was intended to converts int64 and uint64 only.
func ToInt64(v interface{}) int64 {
switch vType := v.(type) {
case uint64:
return int64(vType)
case int64:
return vType
}
panic("not a number")
}
The text was updated successfully, but these errors were encountered:
@ahmed-hossam28: yes, It Is intended for int64 only, but panic should not happen while executing queries, so sounds like there is an issue somewhere.
Could you please share the query which causes the panic?
.....
documents := []*d.Document{doc1, doc2}
// Create a new query to find documents where age is greater than 30
q := query.NewQuery("users")
q = q.Where(query.Field("age").In(int32(20)))
// Iterate over documents and apply query
for _, doc := range documents {
if q.Satisfy(doc) {
fmt.Println("Matching Document:", doc)
}
}
Hi there!
While testing queries, I encountered a panic when passing an int32 value to a query that i found uses ToInt64 function. The function converts only uint64 and int64 types to int64. If an int, int32, or any other type is passed, the function panics with the message “not a number” so i wondered if it was intended to converts int64 and uint64 only.
The text was updated successfully, but these errors were encountered: