V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
buseni
V2EX  ›  问与答

最近用 beego 写了一个爬虫程序,但是我操作数据库的时候出了问题,我数据库字段都是大写,这个框架默认会给我转化成小写,还会拆分?

  •  
  •   buseni · 2017-03-28 13:33:13 +08:00 · 1021 次点击
    这是一个创建于 2585 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我怎么做,我写的什么字段,就是什么字段,对我的这些字段不做额外的处理?

    //此字段数据库全部是大写

    type Content struct { ID int orm:"pk;auto" Title string Content string MD5 string Path string Tag string orm:"default(0) Source string Shares int orm:"default(0) Hits int orm:"default(0)" Comments int orm:"default(0)" Status int orm:"default(1)" UpdateTime time.Time orm:"auto_now_add;type(datetime)" }

    func SaveContent(content *Content) int64 { orm.Debug = true //true 打印数据库操作日志信息 o := orm.NewOrm() id, _ := o.Insert(content) return id

    } 打印日志就都是小写了

    INSERT INTO content (title, content, m_d5, path, tag, source, shares, hits, comments, status, update_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] - `

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3297 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 12:32 · PVG 20:32 · LAX 05:32 · JFK 08:32
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.