Documentation
¶
Index ¶
- type ArticleService
- func (s *ArticleService) CreateArticle(data *models.ArticleModel) error
- func (s *ArticleService) DeleteArticle(id string) error
- func (s *ArticleService) GetArticleByID(id string) (*models.ArticleModel, error)
- func (s *ArticleService) GetArticles(request http.Request, search string) (paginate.Page, error)
- func (s *ArticleService) UpdateArticle(id string, data *models.ArticleModel) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArticleService ¶
type ArticleService struct {
// contains filtered or unexported fields
}
func NewArticleService ¶
func NewArticleService(db *gorm.DB, ctx *context.ERPContext) *ArticleService
func (*ArticleService) CreateArticle ¶
func (s *ArticleService) CreateArticle(data *models.ArticleModel) error
CreateArticle creates a new article in the database.
The function takes a pointer to an ArticleModel, which contains the data to be inserted into the database. It returns an error if the insertion fails, or nil if the insertion is successful.
func (*ArticleService) DeleteArticle ¶
func (s *ArticleService) DeleteArticle(id string) error
func (*ArticleService) GetArticleByID ¶
func (s *ArticleService) GetArticleByID(id string) (*models.ArticleModel, error)
GetArticleByID retrieves an article from the database by its ID.
It takes an ID as input and returns an ArticleModel and an error. The function uses GORM to retrieve the article data from the articles table. If the operation fails, an error is returned.
func (*ArticleService) GetArticles ¶
func (*ArticleService) UpdateArticle ¶
func (s *ArticleService) UpdateArticle(id string, data *models.ArticleModel) error
Click to show internal directories.
Click to hide internal directories.