forked from jinzhu/gorm
-
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
11 changed files
with
390 additions
and
353 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,28 @@ | ||
package gorm_test | ||
|
||
import "testing" | ||
|
||
type BasePost struct { | ||
Id int64 | ||
Title string | ||
Url string | ||
} | ||
|
||
type HNPost struct { | ||
BasePost | ||
Upvotes int32 | ||
} | ||
|
||
type EngadgetPost struct { | ||
BasePost | ||
ImageUrl string | ||
} | ||
|
||
func TestAnonymousStruct(t *testing.T) { | ||
hn := HNPost{} | ||
hn.Title = "hn_news" | ||
DB.Debug().Save(hn) | ||
|
||
var news HNPost | ||
DB.Debug().First(&news) | ||
} |
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.