generated from cloudwego/.github
-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(gomall/tutorial): update code after record
- Loading branch information
Showing
34 changed files
with
459 additions
and
659 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
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 |
---|---|---|
|
@@ -29,8 +29,22 @@ func main() { | |
panic(err) | ||
} | ||
dal.Init() | ||
mysql.DB.Create(&model.User{Email: "[email protected]", Password: "a958af3702caf245d205da6164afebe0"}) | ||
var u model.User | ||
mysql.DB.First(&u) | ||
fmt.Printf("%#v", u) | ||
// CURD | ||
|
||
// Create | ||
// mysql.DB.Create(&model.User{Email: "[email protected]", Password: "jfiojffjsoij"}) | ||
|
||
// Update | ||
// mysql.DB.Model(&model.User{}).Where("email = ?", "[email protected]").Update("password", "22222222") | ||
|
||
// Read | ||
var row model.User | ||
mysql.DB.Model(&model.User{}).Where("email = ?", "[email protected]").First(&row) | ||
|
||
fmt.Printf("row: %+v\n", row) | ||
|
||
// Delete | ||
// mysql.DB.Where("email = ?", "[email protected]").Delete(&model.User{}) | ||
|
||
// mysql.DB.Unscoped().Where("email = ?", "[email protected]").Delete(&model.User{}) | ||
} |
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 |
---|---|---|
|
@@ -10,3 +10,4 @@ services: | |
- 3306:3306 | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=root | ||
- MYSQL_DATABASE=demo_proto |
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
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 |
---|---|---|
|
@@ -29,8 +29,22 @@ func main() { | |
panic(err) | ||
} | ||
dal.Init() | ||
mysql.DB.Create(&model.User{Email: "[email protected]", Password: "a958af3702caf245d205da6164afebe0"}) | ||
var u model.User | ||
mysql.DB.First(&u) | ||
fmt.Printf("%#v", u) | ||
// CURD | ||
|
||
// Create | ||
// mysql.DB.Create(&model.User{Email: "[email protected]", Password: "jfiojffjsoij"}) | ||
|
||
// Update | ||
// mysql.DB.Model(&model.User{}).Where("email = ?", "[email protected]").Update("password", "22222222") | ||
|
||
// Read | ||
var row model.User | ||
mysql.DB.Model(&model.User{}).Where("email = ?", "[email protected]").First(&row) | ||
|
||
fmt.Printf("row: %+v\n", row) | ||
|
||
// Delete | ||
// mysql.DB.Where("email = ?", "[email protected]").Delete(&model.User{}) | ||
|
||
// mysql.DB.Unscoped().Where("email = ?", "[email protected]").Delete(&model.User{}) | ||
} |
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 |
---|---|---|
|
@@ -10,3 +10,4 @@ services: | |
- 3306:3306 | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=root | ||
- MYSQL_DATABASE=demo_proto |
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
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 |
---|---|---|
|
@@ -29,8 +29,22 @@ func main() { | |
panic(err) | ||
} | ||
dal.Init() | ||
mysql.DB.Create(&model.User{Email: "[email protected]", Password: "a958af3702caf245d205da6164afebe0"}) | ||
var u model.User | ||
mysql.DB.First(&u) | ||
fmt.Printf("%#v", u) | ||
// CURD | ||
|
||
// Create | ||
// mysql.DB.Create(&model.User{Email: "[email protected]", Password: "jfiojffjsoij"}) | ||
|
||
// Update | ||
// mysql.DB.Model(&model.User{}).Where("email = ?", "[email protected]").Update("password", "22222222") | ||
|
||
// Read | ||
var row model.User | ||
mysql.DB.Model(&model.User{}).Where("email = ?", "[email protected]").First(&row) | ||
|
||
fmt.Printf("row: %+v\n", row) | ||
|
||
// Delete | ||
// mysql.DB.Where("email = ?", "[email protected]").Delete(&model.User{}) | ||
|
||
// mysql.DB.Unscoped().Where("email = ?", "[email protected]").Delete(&model.User{}) | ||
} |
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 |
---|---|---|
|
@@ -10,3 +10,4 @@ services: | |
- 3306:3306 | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=root | ||
- MYSQL_DATABASE=demo_proto |
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.