gorm
gorm copied to clipboard
Create View feature is missing, kind of very important
Create View feature with Gorm
Describe the feature
db.
View.
CreateOrUpdate().
Tables(....tables Names ). // strings
Entities(....tables Names ). // interfaces
Select(columNames...). // 5 or 6 columns it is optional
Join(joinClause).
Alias(Entity, map[string]string{})
Where(...., ...).
ViewName("Give it a name"). // Optional, could come from tables or be placed
Compile() // finisher method, builder, ends the chain
Motivation
Database views are easily queried on compiled join queries. Currently, the framework doesn't support joins properly. It supports but requires manual work. If we have a view creation option it will reduce the work and query execution and improve the performance
Related Issues
Tags
@riadevatix
Keywords
View, ViewCreation, JoinFeauture, SqlInjection
thanks, It's a good idea, but maybe need to think about how to support it. :stuck_out_tongue:
@jinzhu and @ghost This should be a priority
Absolutely cannot wait for these features!
Bump: any update on this?
+1
Please prioritize this for the upcoming releases.
Is there any progress on this?
Already implemented in https://github.com/go-gorm/gorm/pull/6097
Hi, guys. I have a problem when I using gorm to operate pgsql tables. I have about three tables need to be querying, so I created a db view to handle my data. But I cannot use gorm to mapping this view just like I mapping others table models. So Can gorm mapping views like table models? I really want it! Thanks.