Skip to content

Example not work #445

@alpacaca

Description

@alpacaca

I am trying to use goqu and executing it from the official example:

https://github.com/doug-martin/goqu/blob/master/docs/updating.md#limit
Image
(By the way, the lable is wrong)

But I found that the result is inconsistent with the example

func main() {
	ds := goqu.Dialect("mysql").
		Update("test").
		Set(goqu.Record{"foo": "bar"}).
		Limit(10)
	sql, _, _ := ds.ToSQL()
	fmt.Println(sql)
}

// result:
// UPDATE "test" SET "foo"='bar'

// expected UPDATE "test" SET "foo"='bar' LIMIT 10

Another example is UPDATE ORDER:

Image
func main() {
	ds := goqu.Dialect("mysql").
		Update("test").
		Set(goqu.Record{"foo": "bar"}).
		Order(goqu.C("a").Asc())
	sql, _, _ := ds.ToSQL()
	fmt.Println(sql)
}

// result: UPDATE "test" SET "foo"='bar'

// expected: UPDATE "test" SET "foo"='bar' ORDER BY a ASC

golang version:
go version go1.25.0 darwin/arm64

goqu version:
github.com/doug-martin/goqu/v9 v9.19.0

Dialect:

  • mysql

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions