I know, https://github.com/go-pg/pg/issues/125 closed.
But maybe possible to support "index" marker?
type Logs struct {
ID int64
Log string
CreatedAt time.Time `sql:",index"`
}
And go-pg will create index for created_at field?
If somebody's gonna implement this, please, don't forget about other options for create index query such as method(btree, hash, gist, and gin).
I believe it is easier to use raw sql in this case via https://github.com/go-pg/pg/wiki/Writing-Queries#executing-custom-queries, because there are lots of options and order of columns matters a lot.
It would be better to support at least the standard stuff like creating a simple index for a date as @Labutin suggested. This way most scenarios can be covered with the least effort from the library and from the using developer's side.
Please reconsider adding this feature with rudimentary or no options.
Most helpful comment
It would be better to support at least the standard stuff like creating a simple index for a date as @Labutin suggested. This way most scenarios can be covered with the least effort from the library and from the using developer's side.
Please reconsider adding this feature with rudimentary or no options.