我是用了xorm工具反轉(zhuǎn)數(shù)據(jù)庫(kù)獲取表結(jié)構(gòu)。得到結(jié)構(gòu)體如下typeUserUserstruct{Idint`xorm:"notnullpkautoincrunique(id,sys_group_id,branch_id)INT(11)"`Nicknamestring`xorm:"default''comment('用戶名')VARCHAR(200)"`Emailstring`xorm:"default''comment('email')indexVARCHAR(64)"`EmailIsavalibleint`xorm:"notnulldefault0comment('email是否驗(yàn)證')TINYINT(4)"`Mobilestring`xorm:"default''comment('手機(jī)號(hào)')indexCHAR(16)"`MobileIsavalibleint`xorm:"notnulldefault0comment('mobile是否驗(yàn)證')TINYINT(4)"`Passwordstring`xorm:"notnulldefault''comment('密碼')CHAR(64)"`Isavalibleint`xorm:"notnulldefault0comment('是否可用')TINYINT(4)"`Customerkeystring`xorm:"notnulldefault''comment('用戶key,自動(dòng)生成')CHAR(64)"`Createdatetime.Time`xorm:"notnulldefault'CURRENT_TIMESTAMP'indexTIMESTAMP"`Useripstring`xorm:"notnulldefault''VARCHAR(50)"`Levelint`xorm:"default0comment('0學(xué)員1員工')INT(11)"`SysGroupIdint`xorm:"comment('部門(mén)編號(hào)')unique(id,sys_group_id,branch_id)INT(11)"`CompanyIdint`xorm:"default0unique(id,sys_group_id,branch_id)INT(11)"`CreateUseridint`xorm:"INT(11)"`CreateFlagstring`xorm:"VARCHAR(255)"`CreateGroupint`xorm:"INT(11)"`Mobliephonefaceurlstring`xorm:"comment('app人臉圖片地址')VARCHAR(128)"`Mobliephonefacestatusstring`xorm:"default'0'comment('預(yù)留狀態(tài)0初始化1已預(yù)留2申請(qǐng)修改3審批通過(guò)(審批通過(guò)后并且預(yù)留通過(guò)后改為1狀態(tài))')CHAR(1)"`Mobliephonevoiceidstring`xorm:"comment('app聲紋信息id')VARCHAR(50)"`Mobliephonevoicestatusstring`xorm:"default'0'comment('預(yù)留狀態(tài)0初始化1已預(yù)留2申請(qǐng)修改3審批通過(guò)(審批通過(guò)后并且預(yù)留通過(guò)后改為1狀態(tài))')CHAR(1)"`Pcfaceurlstring`xorm:"comment('pc人臉圖片地址')VARCHAR(128)"`Pcfacestatusstring`xorm:"default'0'comment('預(yù)留狀態(tài)0初始化1已預(yù)留2申請(qǐng)修改3審批通過(guò)(審批通過(guò)后并且預(yù)留通過(guò)后改為1狀態(tài))')CHAR(1)"`Pcvoiceidstring`xorm:"comment('pc聲紋信息id')VARCHAR(64)"`Pcvoicestatusstring`xorm:"default'0'comment('預(yù)留狀態(tài)0初始化1已預(yù)留2申請(qǐng)修改3審批通過(guò)(審批通過(guò)后并且預(yù)留通過(guò)后改為1狀態(tài))')CHAR(1)"`Mobliephonefacebytestring`xorm:"TEXT"`Pcfacebytestring`xorm:"MEDIUMTEXT"`}```現(xiàn)在我進(jìn)行數(shù)據(jù)庫(kù)查詢,語(yǔ)句如下engine,err=xorm.NewEngine("mysql","name:pwd@tcp(ip:port)/xxxxx?charset=utf8")users:=make([]model.UserUser,0)err=engine.Alias("t").Where("t.mobile=?","123").Find(&users)執(zhí)行時(shí)會(huì)報(bào)錯(cuò)fieldIdtagunique(id,cannotmatch)charactor請(qǐng)問(wèn)是哪里寫(xiě)的有問(wèn)題?
使用xorm反轉(zhuǎn)數(shù)據(jù)庫(kù)獲取表結(jié)構(gòu)后,查詢失敗
達(dá)令說(shuō)
2019-04-27 17:17:00