snippet-end:[dynamodb.go.add_items.struct] GetItems creates a list of table items from a JSON file
(filename *string)
| 29 | |
| 30 | // GetItems creates a list of table items from a JSON file |
| 31 | func GetItems(filename *string) ([]Item, error) { |
| 32 | raw, err := ioutil.ReadFile(*filename) |
| 33 | if err != nil { |
| 34 | return nil, err |
| 35 | } |
| 36 | |
| 37 | var items []Item |
| 38 | err = json.Unmarshal(raw, &items) |
| 39 | if err != nil { |
| 40 | return nil, err |
| 41 | } |
| 42 | |
| 43 | return items, nil |
| 44 | } |
| 45 | |
| 46 | // GetMovieName gets the name of the movie from an attribute value |
| 47 | func GetMovieName(av map[string]*dynamodb.AttributeValue) (string, error) { |
no outgoing calls