The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
ifconfig

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

  •  
  •   ifconfig · Dec 26, 2020 · 1824 views
    This topic created in 2005 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   ·   983 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 19:15 · PVG 03:15 · LAX 12:15 · JFK 15:15
    ♥ Do have faith in what you're doing.