Update

Update new rows in the database.

This type is used in the examples on this page.

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

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

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

Your value must have the primary key set (ie, not the zero value).

Last updated