I have map[string]interface input user like below
user := map[string]interface{}{
"firstname": firstname,
"lastname": lastname,
"country": country,
"email": email,
}
Values given above are from other functions as variables hence not indicated in "".
For example, I need to generate a dynamic query as follows from the above interface: "INSERT INTO USERTABLE (key1, key2, key3, key4) VALUES (val1, val2, val3, val4) RETURNING id
where the iterator will count keys and values and will generate the query as below
"INSERT INTO USERTABLE (firstname, lastname, country, email) VALUES (firstname, lastname, country, email) RETURNING userid"
Looking to build a dynamic string.
CodePudding user response:
Pure Go