我有一個設置為十進制的數據庫字段,而在我的 Go 項目中,我在選擇可以使用的數據類型時遇到問題。每次我向我的代碼發送一個創建請求時,我都會得到一個“無法將'十進制'編組到#golang數據類型#這是我的數據庫架構CREATE TABLE wage_garnishment(organization_id timeuuid,yyyy text,employee_id timeuuid,id timeuuid,employee_name text,amount decimal,deductions int,date_created date,date_modified date,date_approved date,PRIMARY KEY ((organization_id, yyyy), id))我的 golang 模型看起來像這樣type WageGarnishment struct {ID gocql.UUID `json:"id"`organizationID gocql.UUID `json:"organization_id"`Yyyy string `json:"yyyy"`Amount Float64 `json:"amount"`Deductions uint `json:"deductions"`EffectiveDate time.Time `json:"effective_date"`DateCreated time.Time `json:"date_created"`DateApproved time.Time `json:"date_approved"`DateModified time.Time `json:"date_modified"`EmployeeSummary}無論我的金額字段中的數據類型如何,我都會收到此錯誤:Error #01: can not marshal float64 into decimal提前感謝您的幫助
添加回答
舉報
0/150
提交
取消