Skip to content

Commit

Permalink
Fix code example errors
Browse files Browse the repository at this point in the history
  • Loading branch information
System-Glitch committed Sep 1, 2024
1 parent f316925 commit f10bc02
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"markdown-it-container": "^4.0.0",
"medium-zoom": "^1.1.0",
"vite-svg-loader": "^5.1.0",
"vitepress": "^1.3.3",
"vitepress": "^1.3.4",
"vue": "^3.4.38"
},
"author": "Jérémy LAMBERT (System-Glitch)",
Expand Down
2 changes: 1 addition & 1 deletion src/advanced/dto-and-model-mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (s *Service) Register(ctx context.Context, user *dto.RegisterUser) (*dto.Us
```go
// database/repository/user.go
func (r *User) Create(ctx context.Context, user *model.User) (*model.User, error) {
db := session.DB(ctx, r.DB).Omit(clause.Associations).SCreate(user)
db := session.DB(ctx, r.DB).Omit(clause.Associations).Create(user)
return user, errors.New(db.Error)
}
```
Expand Down
4 changes: 3 additions & 1 deletion src/basics/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ import (

"gorm.io/gorm"
"goyave.dev/goyave/v5/database"
"goyave.dev/goyave/v5/util/session"
"my-project/database/model"
)

Expand All @@ -170,7 +171,8 @@ type User struct {
func (r *User) Paginate(ctx context.Context, page int, pageSize int) (*database.Paginator[*model.User], error) {
users := []*model.User{}

paginator := database.NewPaginator(r.DB, page, pageSize, &users)
db := session.DB(ctx, r.DB)
paginator := database.NewPaginator(db, page, pageSize, &users)
err := paginator.Find()
return paginator, err
}
Expand Down

0 comments on commit f10bc02

Please sign in to comment.