I am writing a wiki as exercise to learn Go
I have professional experience only in programming CNC and Robotics, and as hobby, Basic back from the days of Commodore C64 and PHP
I also know a little Python & Ruby.
But Go opens up a whole new world.
Since I don't wont any database dependency, I was going to save some data, I keep in memory to json, and loaded back at startup when it came to me that there must be a way to save the data as binary.
Some Googling resulted in C++ and .NET sample code, and I also found bits and pieces of Go, but I am not able to wrap my head around it so I was wondering if I can get some help.
I need to save a map that looks like following code . How would I go about that?
var Wikis map[int]jsonWiki
type jsonWiki struct {
Title string
File string
User string
//Groups []wikiGroups
//Keys [5]string
Time int64
}
//groups wikiGroups, , keys [5]string
func (p *jsonWiki) PutJsonWiki(title string, file string, user string) {
p.Title = title
p.File = file
p.User = user
//p.Groups = groups
//p.Keys = keys
p.Time = time.Now().Unix()
}
Wikis = make(map[int]jsonWiki)
addWiki("Lobby", "lobby.html", "admin")
addWiki("Linux", "linux.html", "admin")