-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"io/ioutil" | ||
"reflect" | ||
|
||
"gopkg.in/yaml.v2" | ||
) | ||
|
||
func main() { | ||
test := make(map[interface{}]interface{}) | ||
|
||
data, err := ioutil.ReadFile("types.yaml") | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
err = yaml.Unmarshal(data, &test) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
for entry, ev := range test { | ||
fmt.Println(entry) | ||
evv := reflect.ValueOf(ev) | ||
if evv.Kind() == reflect.Map { | ||
for _, content := range evv.MapKeys() { | ||
cv := evv.MapIndex(content).Interface() | ||
fmt.Println(" ", content) | ||
|
||
cvv := reflect.ValueOf(cv) | ||
if cvv.Kind() == reflect.Map { | ||
for _, field := range cvv.MapKeys() { | ||
fv := cvv.MapIndex(field) | ||
fmt.Println(" ", field, "->", fv) | ||
} | ||
} else { | ||
fmt.Println(" >", cv) | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
article: | ||
desc: An article in a journal, magazine, newspaper, or other periodical which forms a self-contained unit with its own title. | ||
req: | ||
author: Author(s) of the article. | ||
title: Title of the article. | ||
journaltitle: Title of the journal. | ||
date: YYYY-MM-DD format. | ||
opt: | ||
editor: Editor(s) of the journal. | ||
language: Language of the article. | ||
series: Series of the journal. | ||
volume: Volume of the journal. | ||
number: Number of the journal. | ||
issn: ISSN number of the article. | ||
doi: DOI code of the article. | ||
url: URL of the article. | ||
urldate: Access date in YYY-MM-DD format. |