-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Changed the way error handling
- Loading branch information
1 parent
d403129
commit 33877ee
Showing
5 changed files
with
38 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package models | ||
|
||
type Licence struct { | ||
ID string `json:"id"` | ||
Data string `json:"data"` | ||
ExtensionID string `json:"extension_id"` | ||
CreatedAt string `json:"created_at"` | ||
UpdatedAt string `json:"updated_at"` | ||
} | ||
|
||
func (Licence) TableName() string { | ||
return "licenses" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package liman |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package liman | ||
|
||
import ( | ||
"github.com/gofiber/fiber/v2" | ||
"github.com/limanmys/render-engine/app/models" | ||
"github.com/limanmys/render-engine/internal/database" | ||
) | ||
|
||
func GetUser(user *models.User) (*models.User, error) { | ||
result := database.Connection().First(&user) | ||
|
||
if result.Error != nil { | ||
return nil, fiber.NewError(fiber.StatusNotFound, "Cannot found user with this id") | ||
} | ||
|
||
if result.RowsAffected > 0 { | ||
return user, nil | ||
} | ||
|
||
return nil, fiber.NewError(fiber.StatusNotFound, "Cannot found user with this id") | ||
} |
This file was deleted.
Oops, something went wrong.