the result wantedI have a struct in go
type Users struct {
ID int `json:"id"`
Name string `json:"name"`
Age string `json:"age"`
}
I have a mysql database in which some age values are nil so basically to make it dynamic I've been searching for the solution. "Age string json:-
" to hide the field if it is returnig the value nil from mysql.
I did two queries
query1: select id,name,age from users where age is not null
query2: select id,name from users where age is null
How can I make it a dynamic query to show the age if exsits else it doesn't don't show it?