V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
imherer

gorm 如何使用 postgresql 中 schema 下的 table

  •  
  •   imherer · Sep 7, 2020 · 2520 views
    This topic created in 2063 days ago, the information mentioned may be changed or developed.
    默认 gorm 时都是使用 db 下的 table,那如何使用 db 下 schema 中的 table 呢?
    2 replies    2020-09-09 09:29:39 +08:00
    xifengzhu
        1
    xifengzhu  
       Sep 8, 2020
    默认应该是 public 这个 schema 中的 table,gorm 没看到支持这个方面的文档,可以去 github 提个问题。
    imherer
        2
    imherer  
    OP
       Sep 9, 2020
    @xifengzhu 谢谢

    之前在 GitHub 上看了下有人也提过类似的问题,jinzhu 的回答是通过 db.Table("schema.table") 这样的方式去解决

    看来目前只能这样了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2440 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 04:50 · PVG 12:50 · LAX 21:50 · JFK 00:50
    ♥ Do have faith in what you're doing.