(catBreed string)
| 240 | } |
| 241 | |
| 242 | func getPicByBreed(catBreed string) (url string, err error) { |
| 243 | data, err := web.GetData(apiURL + "search?breed_ids=" + catBreed) |
| 244 | if err != nil { |
| 245 | return |
| 246 | } |
| 247 | url = gjson.ParseBytes(data).Get("0.url").String() |
| 248 | if url == "" { |
| 249 | err = errors.New("no image found") |
| 250 | } |
| 251 | return |
| 252 | } |
| 253 | |
| 254 | func (sql *catdb) insert(gid string, dbInfo *catInfo) error { |
| 255 | sql.Lock() |