我想使用 Gorp 從包含特殊類型的 DB 加載和保存結(jié)構(gòu)。除其他外,這對(duì)于枚舉字符串(例如角色)很有用:type Role stringtype Account struct { User string Role Role}這不能“開箱即用”。出現(xiàn)錯(cuò)誤消息,例如panic: sql: converting Exec argument #0's type: unsupported type user.Role, a string我懷疑我需要使用 agorp.TypeConverter來解決這個(gè)問題,但沒有關(guān)于如何做到這一點(diǎn)的文檔。你能幫我嗎?
- 1 回答
- 0 關(guān)注
- 156 瀏覽
添加回答
舉報(bào)
0/150
提交
取消