// Copyright 2017 The Xorm Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package xorm import ( "testing" "github.com/stretchr/testify/assert" ) func TestUpdateMap(t *testing.T) { assert.NoError(t, prepareEngine()) type UpdateTable struct { Id int64 Name string Age int } assert.NoError(t, testEngine.Sync2(new(UpdateTable))) var tb = UpdateTable{ Name: "test", Age: 35, } _, err := testEngine.Insert(&tb) assert.NoError(t, err) cnt, err := testEngine.Table("update_table").Where("id = ?", tb.Id).Update(map[string]interface{}{ "name": "test2", "age": 36, }) assert.NoError(t, err) assert.EqualValues(t, 1, cnt) }