• 功夫熊猫
    2021-11-19
    我都是直接靠Raw直接写sql语句的。因为有时候不太好定义模型

    作者回复: 还是orm之争,哈,看来老哥属于极客型

    共 2 条评论
    
  • 宁建峰
    2022-08-24 来自北京
    api_orm.go中,以下代码gin1.8.1已经过过限制了,999<code>100,所以这里使用50001,会发生panic:invalid WriteHeader code 50001 if err != nil { logger.Error(c, err.Error(), nil) c.AbortWithError(50001, err) return } gin v1.8.1 源码如下: func checkWriteHeaderCode(code int) { // Issue 22880: require valid WriteHeader status codes. // For now we only enforce that it's three digits. // In the future we might block things over 599 (600 and above aren't defined // at https://httpwg.org/specs/rfc7231.html#status.codes) // and we might block under 200 (once we have more mature 1xx support). // But for now any three digits. // // We used to send "HTTP/1.1 000 0" on the wire in responses but there's // no equivalent bogus thing we can realistically send in HTTP/2, // so we'll consistently panic instead and help people find their bugs // early. (We can't return an error from WriteHeader even if we wanted to.) if code < 100 || code > 999 { panic(fmt.Sprintf("invalid WriteHeader code %v", code)) } }
    展开
    
    2
  • 老兵
    2022-01-12
    不知道是不是我理解不对,感觉目前gorm在数据库字段的迁移的方案还是不行。比如数据库表加一个字段,删除一个字段,用auto-migrate还是无法做到精准像active_record那样的方便吧? 不知道叶老师是否有一些golang下orm+migration的经验?
    
    
  • 无笔秀才
    2022-01-11
    我觉得除了orm 还应该支持直接sql,毕竟很多人不喜欢用orm
    共 1 条评论
    