I'm trying to write a Gorm custom data type: https://gorm.io/docs/data_types.html
type MyDataType struct {}
func (f *MyDataType) Scan(value interface{}) error {
//
}
func (f MyDataType) Value() (driver.Value, error) {
//
}
For some reasons, I need to access context in Scan
or to be able to retrieve field tags.
Is there a way to do this ? Thanks
Value are based on user space which you may need to change the code to be looks like :
type MyDataType struct {}
func (f *MyDataType) Scan(context context.Context, value interface{}) error {
// proceed the context right there
}
func (f MyDataType) Value() (driver.Value, error) {
//
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With