📋
GoSQL
  • GoSQL
  • Conventions
  • Basic Usage
    • Select Queries
    • Insert
    • Update
    • Delete
  • Advanced Usage
Powered by GitBook
On this page

Was this helpful?

  1. Basic Usage

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).

PreviousInsertNextDelete

Last updated 5 years ago

Was this helpful?