beego curd Values 方法的疑问

我通过使用Values方法获得一定的map

var radio []orm.Params
num, _ := orm.NewOrm().
            QueryTable("product_album").
            Filter("product_id", id).
            Filter("state", 1).
            Values(&radio)

但获得的结果首字母都是大写,我已经在model内设置了小写的规则

type ProductAlbum struct {
    Id   int `json:"id"`
    ProductId int `json:"product_id"`
    Name string `json:"name"`
    Url  string `json:"url"`
    State string `json:"state"`
}

错误的结果

"radio": [
      {
        "Id": 37,
        "Name": "图片",
        "ProductId": 9,
        "State": "0",
        "Url": "7d9006e1d73d527662e598c1856327f28742"
      },
      {
        "Id": 55,
        "Name": "图片",
        "ProductId": 9,
        "State": "0",
        "Url": "38909849c3289db116c020c3d34cfb6f3975"
      },
      {
        "Id": 56,
        "Name": "图片",
        "ProductId": 9,
        "State": "0",
        "Url": "a164deb99004f9647f87f21771d19b468181"
      }
    ]

期望的结果

"radio": [
      {
        "id": 37,
        "name": "图片",
        "productId": 9,
        "state": "0",
        "url": "7d9006e1d73d527662e598c1856327f28742"
      },
      {
        "id": 55,
        "name": "图片",
        "productId": 9,
        "state": "0",
        "url": "38909849c3289db116c020c3d34cfb6f3975"
      },
      {
        "id": 56,
        "name": "图片",
        "productId": 9,
        "state": "0",
        "url": "a164deb99004f9647f87f21771d19b468181"
      }
    ]

请大佬指点一二,谢谢

阅读 935
评论
    2 个回答

    orm:"column(id)";json:"id" 这样呢

      相似问题
      推荐文章