Server-Side Scripting/Key-Value Databases/Go

routes/lesson11.go
"   return result }

func countryExists11(country string) bool { client := redis.NewClient(&redis.Options{       Addr:     HOST11,        Password: PASSWORD11,        DB:       DATABASE11,    })

result, err := client.Exists(country).Result if err != nil { log.Fatal(err) }

return result == 1 }

func insertCountry11(country string, temperature string) { client := redis.NewClient(&redis.Options{       Addr:     HOST11,        Password: PASSWORD11,        DB:       DATABASE11,    })

err := client.Set(country, temperature, 0).Err if err != nil { log.Fatal(err) } }

func updateCountry11(country string, temperature string) { client := redis.NewClient(&redis.Options{       Addr:     HOST11,        Password: PASSWORD11,        DB:       DATABASE11,    })

err := client.Set(country, temperature, 0).Err if err != nil { log.Fatal(err) } }

func deleteCountry11(country string) { client := redis.NewClient(&redis.Options{       Addr:     HOST11,        Password: PASSWORD11,        DB:       DATABASE11,    })

err := client.Del(country).Err if err != nil { log.Fatal(err) } }

Try It
See ../../Routes and Templates/Go to create a test environment.