Scan error on column index x, name "": converting NULL to string
golang sqlite錯誤
sql: Scan error on column index x, name "field name": converting NULL to string is unsupported
在sqlite中如果字段非主鍵,是不允許非空not null的
一種方法是采用指針的方式
但在后臺獲取到的值也是指針而非可讀的字符串,雖然返回前端后沒有問題
另外一種方式是使用sql.NullString
這樣Name就會攜帶有Valid和String兩種屬性,需要在讀取后進(jìn)行判斷
vue3 axios前端Response
element plus中判斷處理數(shù)據(jù)
標(biāo)簽: