Interface conversion: interface {} is nil, not float64

what does it mean? I get it After sql query when I get rows

rows, err := con.Query(`
select 
c.playmarket,
c.appstore,
to_json(array_agg(distinct c.jsjs)) as cities
from
( select 
	z.playmarket,
	z.appstore,
	( select x from (select z.city_id, z.city_name) x) as jsjs
	from (
	select 
	cc.playmarket,
	cc.appstore,
	from
	cards as cc
	left join card_city as ccc ON ccc._card = cc.id
	left join cities as ci ON ci.id = ccc._city
	 ) z
	) as c
	
	group by
	c.card_id,
	c.playmarket,
c.appstore,

`)
if err != nil {
	log.Println(err)
	return nil, err
}

var citiesStr string
var cities []map[string]interface{}
var response pb.CardsRes
var itemResponse Cards
j := 0
for rows.Next() {
	err = rows.Scan(
	
		&itemResponse.PlayMarket,
		&itemResponse.AppStore,
		
	)
	if err != nil {
		log.Println(err)
		return nil, err
	}
	json.Unmarshal([]byte(citiesStr), &cities)

Could you provide some code?

I guess I have found an error, Idk why but the very last raw is of type nil ("< nil >")

Could be a field in the database which can be NULL…

I made an sql query inside pgadmin and there is no nil fields

As Johan asked, could you show us some code? Otherwise we are just guessing.

1 Like

sure

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.