gorm icon indicating copy to clipboard operation
gorm copied to clipboard

Create View feature is missing, kind of very important

Open aukgit opened this issue 3 years ago • 6 comments

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

aukgit avatar Dec 29 '21 07:12 aukgit

thanks, It's a good idea, but maybe need to think about how to support it. :stuck_out_tongue:

ghost avatar Jan 06 '22 17:01 ghost

@jinzhu and @ghost This should be a priority

nafeem-evatix avatar Jan 25 '22 10:01 nafeem-evatix

Absolutely cannot wait for these features!

sulthonzh avatar Apr 19 '22 23:04 sulthonzh

Bump: any update on this?

OscBacon avatar Oct 12 '22 07:10 OscBacon

+1

loeffel-io avatar Oct 25 '22 14:10 loeffel-io

Please prioritize this for the upcoming releases.

devav2 avatar Oct 31 '22 20:10 devav2

Is there any progress on this?

egandro avatar Mar 20 '23 20:03 egandro

Already implemented in https://github.com/go-gorm/gorm/pull/6097

a631807682 avatar Mar 22 '23 08:03 a631807682

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.

DomingoR avatar Mar 11 '24 06:03 DomingoR