type Exam struct {
ID int
Name string
Point string
}
db.raw("select id, name, ST_AsText(ST_centroid(geom)) as point").Scan(&result)
this computed field ST_AsText(ST_centroid(geom)) as point
The document you expected this should be explained
Can you decide maybe
type Exam struct {
ID int gorm:"primaryKey;column:id"
Name string
Geom string //postgis geometry field
Point string gorm:"computed:ST_AsText(ST_centroid(geom))" maby Total int gorm:"computed:sum(amount)" etc
}
This issue has been automatically marked as stale because it has been open 360 days with no activity. Remove stale label or comment or this will be closed in 180 days
Your Question
how to solve computed a field?
My solve
type Exam struct { ID int Name string Point string }
db.raw("select id, name, ST_AsText(ST_centroid(geom)) as point").Scan(&result) this computed field ST_AsText(ST_centroid(geom)) as point
The document you expected this should be explained
Can you decide maybe
type Exam struct { ID int
gorm:"primaryKey;column:id"
Name string Geom string //postgis geometry field Point stringgorm:"computed:ST_AsText(ST_centroid(geom))"
maby Total intgorm:"computed:sum(amount)"
etc }