You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
469 B
23 lines
469 B
package article
|
|
|
|
import (
|
|
"context"
|
|
"practice_ArticleVote_Go/api/article"
|
|
"practice_ArticleVote_Go/internal/dao"
|
|
"practice_ArticleVote_Go/internal/service"
|
|
)
|
|
|
|
func init() {
|
|
service.RegisterArticle(New())
|
|
}
|
|
|
|
func New() *iArticle {
|
|
return &iArticle{}
|
|
}
|
|
|
|
type iArticle struct{}
|
|
|
|
func (i iArticle) AddArticle(ctx context.Context, article *article.ArticleReq) (Aid int64, err error) {
|
|
Aid, err = dao.Article.Ctx(ctx).Data(article).InsertAndGetId()
|
|
return Aid, err
|
|
}
|