pip-services3-go / pip-services3-postgres-go

Postresql components for Pip.Services in Golang
MIT License
0 stars 0 forks source link

Recent change to fix rand panic, broke count #4

Closed antonio-alexander closed 3 years ago

antonio-alexander commented 3 years ago

The recent change to fix the rand panic created a new issue, the count is always 0 because the type the empty interface is casted to is wrong, see code snippet below:

        switch r := rows[0].(type) {
        case int64: //correct type case
            count = r
        case map[string]interface{}: //wrong type cast
            count = cconv.LongConverter.ToLong(r["count"])
        }

https://github.com/pip-services3-go/pip-services3-postgres-go/blob/main/persistence/PostgresPersistence.go#L795

The query is correct, fixing the cast will solve the problem, alternatively you could modify the query (I think) if you wanted to maintain the map[string]interface{}.

levichevdmitry commented 3 years ago

Please, use new fixed version in release v1.2.7