github.com/smugmug/godynamo@v0.0.0-20151122084750-7913028f6623/tests/delete_item-param-conf-livetest.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "github.com/smugmug/godynamo/conf" 6 "github.com/smugmug/godynamo/conf_file" 7 delete_item "github.com/smugmug/godynamo/endpoints/delete_item" 8 "github.com/smugmug/godynamo/types/attributevalue" 9 "net/http" 10 "os" 11 ) 12 13 func main() { 14 15 home := os.Getenv("HOME") 16 home_conf_file := home + string(os.PathSeparator) + "." + conf.CONF_NAME 17 home_conf, home_conf_err := conf_file.ReadConfFile(home_conf_file) 18 if home_conf_err != nil { 19 panic("cannot read conf from " + home_conf_file) 20 } 21 home_conf.ConfLock.RLock() 22 if home_conf.Initialized == false { 23 panic("conf struct has not been initialized") 24 } 25 26 tn := "test-godynamo-livetest" 27 tablename1 := tn 28 fmt.Printf("tablename1: %s\n", tablename1) 29 30 // DELETE AN ITEM 31 del_item1 := delete_item.NewDeleteItem() 32 del_item1.TableName = tablename1 33 del_item1.Key["TheHashKey"] = &attributevalue.AttributeValue{S: "AHashKey1"} 34 del_item1.Key["TheRangeKey"] = &attributevalue.AttributeValue{N: "1"} 35 36 body, code, err := del_item1.EndpointReqWithConf(home_conf) 37 if err != nil || code != http.StatusOK { 38 fmt.Printf("fail delete %d %v %s\n", code, err, string(body)) 39 os.Exit(1) 40 } 41 fmt.Printf("%v\n%v\n,%v\n", string(body), code, err) 42 }