Your issue may already be reported! Please search on the issue track before creating one.
What version of Go are you using (go version)?
1.10.4
Which database and its version are you using?
MYSQL 5.6.39
Please provide a complete runnable program to reproduce your issue. IMPORTANT
I am writing a binary object to database, this does not seem to work if I return array of bytes What is the best practice writing/reading binary data using GORM
Need to runnable with GORM's docker compose config or please provides your config.
// Scan scans bytes into Properties
func (i *Properties) Scan(value interface{}) error {
buf, ok := value.([]byte)
if !ok {
return errors.New("Bytes expected")
}
<snip actual unmarshal code>
}
// Value marshals value to bytes
func (i *Properties) Value() (driver.Value, error) {
var buf = []byte
<snip marshal code that write to buf>
return buf, err
}
// Profile - DB representation for profile
type Profile struct {
Properties *Properties `sql:"not null" gorm:"size:32000"`
}
Comment From: github-actions[bot]
This issue will be automatically closed because it is marked as GORM V1 issue, we have released the public testing GORM V2 release and its documents https://v2.gorm.io/docs/ already, the testing release has been used in some production services for a while, and going to release the final version in following weeks, we are still actively collecting feedback before it, please open a new issue for any suggestion or problem, thank you
Also check out https://github.com/go-gorm/gorm/wiki/GORM-V2-Release-Note-Draft for how to use the public testing version and its changelog
Comment From: gi-yt
@krishnavaltix did you find a solution to this?