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
ifconfig

facebook/ent 可以只更新非零字段吗?

  •  
  •   ifconfig · Dec 26, 2020 · 1727 views
    This topic created in 1953 days ago, the information mentioned may be changed or developed.
    因为之前用习惯了 Gorm,当通过 struct 更新时,Gorm 只会更新非零字段,这样可以减少更新前判断的代码量。

    但是翻了一下 ent 的源码和 issue,貌似没有提供类似的操作。

    这样每次 setColumn 前都要对是否零值判断,请问有熟悉的朋友是怎么解决的吗?
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2525 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 85ms · UTC 06:26 · PVG 14:26 · LAX 23:26 · JFK 02:26
    ♥ Do have faith in what you're doing.