Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

support for json-marschalling of columns with datatype numeric in Postgres #289

Open
volkmarbuehringer opened this issue Mar 1, 2017 · 0 comments

Comments

@volkmarbuehringer
Copy link

I use MapScan for accessing all the columns in a sql.
Columns with datatype numeric are fetched as []uint8 and must be converted to another datatype
for Json-serialization. Would it be possible to have a default datatype string for this
datatype for marshalling json ?

for rows.Next() {
	t := make(map[string]interface{})
	if err = rows.MapScan(t); err == nil {
		results = append(results, t)
	} else {
		return
	}

		if val, ok := (*results)[i]["ads_strnr"].([]uint8); ok {
			ga, err := strconv.Atoi(string(val))
			checkErr(err)
			(*results)[i]["ads_strnr"] = ga
		}
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant