本文整理匯總了Golang中github.com/dorajistyle/goyangi/model.Location.Longitude方法的典型用法代碼示例。如果您正苦於以下問題:Golang Location.Longitude方法的具體用法?Golang Location.Longitude怎麽用?Golang Location.Longitude使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/dorajistyle/goyangi/model.Location
的用法示例。
在下文中一共展示了Location.Longitude方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: UpdateLocation
// UpdateLocation updates a location.
func UpdateLocation(c *gin.Context) (model.Location, int, error) {
var location model.Location
var form LocationForm
id := c.Params.ByName("id")
c.BindWith(&form, binding.Form)
if db.ORM.First(&location, id).RecordNotFound() {
return location, http.StatusNotFound, errors.New("Location is not found.")
}
status, err := userPermission.CurrentUserIdentical(c, location.UserId)
if err != nil {
return location, status, err
}
location.Name = form.Name
location.Address = form.Address
location.Latitude = form.Latitude
location.Longitude = form.Longitude
location.Url = form.Url
location.Content = form.Content
if db.ORM.Save(&location).Error != nil {
return location, http.StatusBadRequest, errors.New("Location is not updated.")
}
return location, http.StatusOK, nil
}