首页 > 解决方案 > 如何使用 golang 和 prepare 更新 postgres 中的多行?

问题描述

我想在 golang 中做这样的事情

    update test as t set
        column_a = c.column_a,
        column_c = c.column_c
    from (values
        ('123', 1, '---'),
        ('345', 2, '+++')  
    ) as c(column_b, column_a, column_c) 
    where c.column_b = t.column_b;

我在一次往返中更新多行

stmt.Exec(vals...)有没有办法像where那样做准备vals = []interface{}

标签: postgresqlgo

解决方案


推荐阅读