Skip to content

Instantly share code, notes, and snippets.

@masahiko-nitanda
Created August 20, 2023 11:54
Show Gist options
  • Save masahiko-nitanda/92fa827506b15add82347938a5979e9e to your computer and use it in GitHub Desktop.
Save masahiko-nitanda/92fa827506b15add82347938a5979e9e to your computer and use it in GitHub Desktop.
This Gist is a Go code snippet using GORM to query the "users" table for the first user with the name "Alice". The code uses the Table method to specify the table and performs a search based on the name field.
db.Table("users").Where("name = ?", "Alice").First(&user)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment