MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestUpdateStatementSQL

Function TestUpdateStatementSQL

pkg/sql/ast/sql_test.go:158–168  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

156}
157
158func TestUpdateStatementSQL(t *testing.T) {
159 stmt := &UpdateStatement{
160 TableName: "users",
161 Assignments: []UpdateExpression{{Column: &Identifier{Name: "name"}, Value: &LiteralValue{Value: "Bob", Type: "STRING"}}},
162 Where: &BinaryExpression{Left: &Identifier{Name: "id"}, Operator: "=", Right: &LiteralValue{Value: 1, Type: "INTEGER"}},
163 }
164 want := "UPDATE users SET name = 'Bob' WHERE id = 1"
165 if got := stmt.SQL(); got != want {
166 t.Errorf("SQL() = %s, want %s", got, want)
167 }
168}
169
170func TestDeleteStatementSQL(t *testing.T) {
171 stmt := &DeleteStatement{

Callers

nothing calls this directly

Calls 2

SQLMethod · 0.95
ErrorfMethod · 0.65

Tested by

no test coverage detected