Files
gormlint/tests/testdata/src/references_check/positive.go
GogaCoder 49878c333c feat: references check
... and fixes: parse fields without tags and other logical errors
2024-12-30 21:15:15 +07:00

20 lines
428 B
Go

package references_check
type User struct {
Name string
CompanyID string
Company Company `gorm:"references:code"` // want "Related field \"code\" doesn't exist on model \"Company\""
}
type Company struct {
ID int
Code string
Name string
}
type Order struct {
Id uint `gorm:"primaryKey"`
CompanyID string `gorm:"references:Code"` // want "Related model \"string\" doesn't exist"
Company Company
}