playground icon indicating copy to clipboard operation
playground copied to clipboard

rename column not working

Open maxant opened this issue 1 year ago • 0 comments

Explain your user case and expected results

I have a column in the database named NAME and in the struct I want to call it myName, so I have this struct:

type Organisation2 struct {
    ID    string `gorm:"primaryKey"`
	myName  string `gorm:"column:NAME"` // <<<< THIS SHOULD WORK, BUT ISN'T
}

func (Organisation2) TableName() string {
    return "T_ORGANISATION"
}

but when I read a row, the struct attribute myName is never filled

maxant avatar Oct 22 '24 22:10 maxant