forked from ilibs/gosql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
5 additions
and
5 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 |
---|---|---|
|
@@ -379,7 +379,7 @@ Relation Where: | |
|
||
```go | ||
moment := &MomentList{} | ||
err := gosql.Relation("User" , func(b *Builder) { | ||
err := gosql.Relation("User" , func(b *gosql.ModelStruct) { | ||
//this is builder instance, | ||
b.Where("gender = 0") | ||
}).Get(moment , "select * from moments") | ||
|
@@ -410,10 +410,10 @@ func (u *Users) BeforeCreate() (err error) { | |
return | ||
} | ||
|
||
func (u *Users) AfterCreate(tx *sqlx.tx) (err error) { | ||
func (u *Users) AfterCreate(tx *gosql.DB) (err error) { | ||
if u.Id == 1 { | ||
u.Email = "[email protected]" | ||
Model(u,tx).Update() | ||
tx.Model(u).Update() | ||
} | ||
return | ||
} | ||
|
@@ -441,8 +441,8 @@ Hook func type supports multiple ways: | |
``` | ||
func (u *Users) BeforeCreate() | ||
func (u *Users) BeforeCreate() (err error) | ||
func (u *Users) BeforeCreate(tx *sqlx.Tx) | ||
func (u *Users) BeforeCreate(tx *sqlx.Tx) (err error) | ||
func (u *Users) BeforeCreate(tx *gosql.DB) | ||
func (u *Users) BeforeCreate(tx *gosql.DB) (err error) | ||
``` | ||
|
||
|
||
|