i have create remote schema for some purpose i have to insert a json value like this
"convert_to_money": {"IDR":10000},
i create a mutation field like this
"convert_to_money": {
Type: scalar.JSON,
},
resolver like this :
Convert_to_money := p.Args["convert_to_money"].(map[string]interface{})
struct like this :
type TimeOvertimePolicy struct {
ConvertToMoney JSONB
}
and handler like this :
func UpdateOvertimesPolicy(Convert_to_money model.JSONB) (res gqltypes.SuccessType, err error) {
timeOvertimesPolicy := model.TimeOvertimePolicy{
ConvertToMoney: Convert_to_money,
}
err = pg.DB.Transaction(func(tx *gorm.DB) error {
d := tx.Create(&timeOvertimesPolicy)
}
}
How can i do input null value for case like this?
Which is running now I have to insert a variable "convert_to_money": {} like this if the variable is null
I wish i can insert variable like this if null
"convert_to_money": null