> For the complete documentation index, see [llms.txt](https://twharmon.gitbook.io/gosql/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://twharmon.gitbook.io/gosql/basic-usage/update.md).

# Update

Update new rows in the database.

This type is used in the examples on this page.

```go
type User struct {
    ID       int `gosql:"primary"`
    Email    string
    IsActive bool
}
```

After changing a value, you can update it in the database.

```go
var user User
db.Select("*").Get(&user)
user.Email = "somenewemail@example.com"
db.Update(&user)
```

{% hint style="info" %}
Your value must have the primary key set (ie, not the zero value).
{% endhint %}
