Ejemplo n.º 1
0
func (a *Article) CreateDummyData() {
	var article domain.Article
	for i := 0; i < 30; i++ {
		article = domain.Article{}
		article.Usernick = "아라한사"
		article.Subject = "안녕하세요" + strconv.Itoa(i)
		article.Content = "헬로월드~~" + strconv.Itoa(i)
		Save(&article)
	}
}
Ejemplo n.º 2
0
func TestGetOneArticle(t *testing.T) {
	aritlcleSave := domain.Article{}
	aritlcleSave.Subject = "안녕?"
	aritlcleSave.Content = "헬로월드"
	aritlcleSave.Usernick = "아라한사"
	id, err := Save(&aritlcleSave)
	checkErr(err)
	article := GetOneArticle(id)
	fmt.Println(article)
	fmt.Println("수정시도")
	article.Subject = "수정된 게시글"
	Update(&article)
	article = GetOneArticle(id)
	fmt.Println(article)
}