Skip to content

Commit

Permalink
bug: count clear Joins
Browse files Browse the repository at this point in the history
  • Loading branch information
贾一饼 authored and 贾一饼 committed May 16, 2024
1 parent acf1f9a commit 6be9e36
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package main


type AB struct {
Id int `json:"id" gorm:"primaryKey"`
BId int `json:"aId" gorm:"index"`
Expand All @@ -21,6 +20,8 @@ type B struct {

func main() {

DB.Migrator().DropTable(&AB{}, &A{}, &B{})
DB.Migrator().CreateTable(&AB{}, &A{}, &B{})
var (
count int64
appNodes = []*AB{}
Expand All @@ -30,9 +31,8 @@ func main() {
db.Count(&count)

db.Limit(1).
Offset(0).
Order("id DESC").
Find(&appNodes)
}
Offset(0).
Order("id DESC").
Find(&appNodes)

}

0 comments on commit 6be9e36

Please sign in to comment.