Created
February 11, 2013 02:00
-
-
Save gregworley/4751964 to your computer and use it in GitHub Desktop.
Data Structure in Golang that will be passed to a template to render a side navigation bar based on bootstrap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type NavBar struct { | |
SpanDefault int | |
Content []Category | |
} | |
type Category struct { | |
Name string | |
Content []SubCategory | |
} | |
type SubCategory string | |
var firstSubCat SubCategory = "link one" | |
var secondSubCat SubCategory = "link two" | |
var firstCategory = Category{"Category1", []SubCategory{firstSubCat, secondSubCat}} | |
var p = NavBar{3, []Category{firstCategory}} | |
func main() { | |
fmt.Println(p) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This outputs:
{3 [{Category1 [link one link two]}]}
and will fill: