Skip to content

Instantly share code, notes, and snippets.

@Solution
Last active May 13, 2021 10:33
Show Gist options
  • Select an option

  • Save Solution/44c2e69acd24d9f484d5a5ab3bf72014 to your computer and use it in GitHub Desktop.

Select an option

Save Solution/44c2e69acd24d9f484d5a5ab3bf72014 to your computer and use it in GitHub Desktop.

Revisions

  1. Solution revised this gist May 13, 2021. 1 changed file with 13 additions and 0 deletions.
    13 changes: 13 additions & 0 deletions ex.go
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,16 @@
    type User struct {
    gorm.Model

    Username string
    Firstname string
    Surname string
    Email string
    Phone string
    Password string
    Role string
    Active bool
    }

    FindExistingUser(username string) model.User {
    var user model.User
    database.Where("username = ?", username).First(&user)
  2. Solution revised this gist May 13, 2021. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions ex.go
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    FindExistingUser(username string) model.User {
    database.Where("username = ?", username).First(&user)

    var user model.User
    database.Where("username = ?", username).First(&user)

    return user
    }
  3. Solution created this gist May 13, 2021.
    5 changes: 5 additions & 0 deletions ex.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    FindExistingUser(username string) model.User {
    database.Where("username = ?", username).First(&user)

    return user
    }