Firstly, I've tried solutions from past stackoverflow answers whose questions were related to mine, and nothing has worked, that's why i am asking it as a separate question.
I have two structs in golang
type otherPayments struct {
DebitTo int `json:"debit_To" binding:"required"`
CreditFrom int `json:"credit_from" binding:"required"`
OverallType string `json:"overall_type" binding:"required"`
}
type advanceAndRoomPayment struct {
PmID int `json:"pm_id" binding:"required"` //Payment method id
PmName string `json:"pm_name" binding:"required"` //Payment method name
DebitTo int `json:"debit_To" binding:"required"` //The ledger to debit from
CreditFrom int `json:"credit_from" binding:"required"` //The ledger to credit from
OverallType string `json:"overall_type" binding:"required"` //Overall transaction type
}
And i have 5
SQL columns within my booking_settings
postgresql table
initial
column, type =otherPayments
,JSONB
cancellation
, type =otherPayments
,JSONB
updation
, type =otherPayments
,JSONB
advance_payment
type =advanceAndRoomPayment
,JSONB []
room_payment
, type =advanceAndRoomPayment
,JSONB []
The SELECT
query is as follows
SELECT initial, cancellation, updation advance_payment, room_payment FROM booking_settings WHERE hotel_id = $1
The sql package i am using is https://jmoiron.github.io/sqlx/
I am trying to scan above columns into their appropriate struct vars, so far i could only manage to scan initial, cancellation and updation
but not the JSONB []
advance_payment and room_payment
Any help is really appreciated, thank you