I am new to Go and love it so far but it seems that I cannot find a simple solution to this.
I want to create a constant that I can reference in my code by Key and get its value
I have this:
const (
DBName = "goApi"
UsersTable string = "users"
)
And would like to have a Tables constant variable that stores the value
Example:
var Tables = {
UsersTable : "users",
PostsTable : "posts"
}
//Somewhere else in the code
fmt.Println(Tables.UsersTable) //output "users"
How can I achieve this in Go?