mirror of
https://github.com/beego/bee.git
synced 2025-07-05 18:20:18 +00:00
Generate fixes for model and controller
- use int64 for all places handling model id - use controller code from appcode if a matching model is found
This commit is contained in:
@ -140,7 +140,7 @@ func Add{{modelName}}(m *{{modelName}}) (id int64, err error) {
|
||||
|
||||
// Get{{modelName}}ById retrieves {{modelName}} by Id. Returns error if
|
||||
// Id doesn't exist
|
||||
func Get{{modelName}}ById(id int) (v *{{modelName}}, err error) {
|
||||
func Get{{modelName}}ById(id int64) (v *{{modelName}}, err error) {
|
||||
o := orm.NewOrm()
|
||||
v = &{{modelName}}{Id: id}
|
||||
if err = o.Read(v); err == nil {
|
||||
@ -240,7 +240,7 @@ func Update{{modelName}}ById(m *{{modelName}}) (err error) {
|
||||
|
||||
// Delete{{modelName}} deletes {{modelName}} by Id and returns error if
|
||||
// the record to be deleted doesn't exist
|
||||
func Delete{{modelName}}(id int) (err error) {
|
||||
func Delete{{modelName}}(id int64) (err error) {
|
||||
o := orm.NewOrm()
|
||||
v := {{modelName}}{Id: id}
|
||||
// ascertain id exists in the database
|
||||
|
Reference in New Issue
Block a user