V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
di1012

问一个 beego 布尔类型映射的问题

  •  
  •   di1012 · Sep 30, 2020 · 3147 views
    This topic created in 2035 days ago, the information mentioned may be changed or developed.

    mysql 表中的 bit 类型的字段,映射到 model 中报错:

    Raw value: [1] convert to *bool failed, field: admin-system/models.Articles.IsShow err: strconv.ParseBool: parsing "\x01": invalid syntax

    数据库中的表是已有的表,正常来说不是 bit -> bool 来映射吗? 为什么取出来的数据是[1]和[0]这种格式呢?

    model 代码:

    type Articles struct { Id int Title string IsShow bool .... }

    其他类型的数据是正常的

    beego 小白求大神解答!

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3928 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 05:06 · PVG 13:06 · LAX 22:06 · JFK 01:06
    ♥ Do have faith in what you're doing.