We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The original content:
package models import ( "gorm.io/gorm" ) // Location 位置,分部,办公室 type Location struct { ID uint `json:"id,omitempty" gorm:"primaryKey"` // 主建 OrganizationID uint `json:"organization_id" gorm:"uniqueIndex:uix_org_name"` // 组织 ID Name string `json:"name" gorm:"size:255;uniqueIndex:uix_org_name" binding:"required"` // 名称 Description string `json:"description" gorm:"type:text"` // 描述 Avatar string `json:"avatar"` // LOGO Address string `json:"address"` // 地址 ZipCode string `json:"zip_code"` // 邮政编码 Phone string `json:"phone"` // 电话号码 Fax string `json:"fax"` // 传真 Position float64 `json:"position"` // 排序位置 CreatedAt int64 `json:"created_at,omitempty"` // 创建时间 UpdatedAt int64 `json:"updated_at,omitempty"` // 更新时间 CountMembers int `json:"count_members" sql:"-"` } // AfterCreate gorm after create Callback func (location *Location) AfterCreate(tx *gorm.DB) (err error) { err = tx.UpdateColumn("position", location.ID).Error return }
After run formattag:
package models import ( "gorm.io/gorm" ) // Location 位置,分部,办公室 type Location struct { ID uint `json:"id,omitempty" gorm:"primaryKey"` // 主建 OrganizationID uint `json:"organization_id" gorm:"uniqueIndex:uix_org_name"` // 组织 ID Name string `json:"name" gorm:"size:255;uniqueIndex:uix_org_name" binding:"required"` // 名称 Description string `json:"description" gorm:"type:text"` // 描述 Avatar string `json:"avatar"` // LOGO Address string `json:"address"` // 地址 ZipCode string `json:"zip_code"` // 邮政编码 Phone string `json:"phone"` // 电话号码 Fax string `json:"fax"` // 传真 Position float64 `json:"position"` // 排序位置 CreatedAt int64 `json:"created_at,omitempty"` // 创建时间 UpdatedAt int64 // 更新时间 CountMembers int `json:"count_members" sql:"-"` } // AfterCreate gorm after create Callback func (location *Location) AfterCreate(tx *gorm.DB) (err error) { err = tx.UpdateColumn("position", location.ID).Error return }
The text was updated successfully, but these errors were encountered:
fixed.
Sorry, something went wrong.
Use lastest version
No branches or pull requests
The original content:
After run formattag:
The text was updated successfully, but these errors were encountered: