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
466 B

  1. package article
  2. import (
  3. "context"
  4. "practice_ArticleVote_Go/internal/dao"
  5. "practice_ArticleVote_Go/internal/model/do"
  6. "practice_ArticleVote_Go/internal/service"
  7. )
  8. func init() {
  9. service.RegisterArticle(New())
  10. }
  11. func New() *iArticle {
  12. return &iArticle{}
  13. }
  14. type iArticle struct{}
  15. func (i iArticle) AddArticle(ctx context.Context, article do.Article) (Aid int64, err error) {
  16. Aid, err = dao.Article.Ctx(ctx).Data(article).InsertAndGetId()
  17. return Aid, err
  18. }