service

package
v2.4.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNewsNotFound    = apperr.New("news_not_found", apperr.WithTextTranslate(i18n.ErrNewsNotFound), apperr.WithCode(code.NotFound))
	ErrNewsListIsEmpty = apperr.New("news_list_is_empty", apperr.WithTextTranslate(i18n.ErrNewsListIsEmpty), apperr.WithCode(code.NotFound))
	ErrNewsExists      = apperr.New("news_exists_error", apperr.WithTextTranslate(i18n.ErrNewsExists), apperr.WithCode(code.AlreadyExists))
)

Functions

This section is empty.

Types

type Deps

type Deps struct {
	Repositories repository.Repositories
}

type INews added in v2.3.117

type INews interface {
	Trx(db *gorm.DB) INews
	List(ctx context.Context, m *model2.Meta[model.News]) error
	GetById(ctx context.Context, id int) (*model.News, error)
	Create(ctx context.Context, input NewsCreateInput) (*model.News, error)
	Update(ctx context.Context, id int, input NewsUpdateInput) error
	Delete(ctx context.Context, id int) error
}

type News added in v2.3.117

type News struct {
	// contains filtered or unexported fields
}

func NewNews added in v2.3.117

func NewNews(
	newsRepository repository.INewsRepository,
) News

func (News) Create added in v2.3.117

func (s News) Create(ctx context.Context, input NewsCreateInput) (*model.News, error)

func (News) Delete added in v2.3.117

func (s News) Delete(ctx context.Context, id int) error

func (News) Export added in v2.3.117

func (s News) Export(ctx context.Context, taskID int, data []byte, msgChan chan<- *model3.Message) (*model3.Message, error)

func (News) GetById added in v2.3.117

func (s News) GetById(ctx context.Context, id int) (*model.News, error)

func (News) Import added in v2.3.117

func (s News) Import(ctx context.Context, taskID int, data []byte, msgChan chan<- *model3.Message) (*model3.Message, error)

func (News) List added in v2.3.117

func (s News) List(ctx context.Context, m *model2.Meta[model.News]) error

func (News) MassDelete added in v2.3.117

func (s News) MassDelete(ctx context.Context, taskID int, data []byte, msgChan chan<- *model3.Message) (*model3.Message, error)

func (News) MassUpdate added in v2.3.117

func (s News) MassUpdate(ctx context.Context, taskID int, data []byte, msgChan chan<- *model3.Message) (*model3.Message, error)

func (News) Trx added in v2.3.117

func (s News) Trx(db *gorm.DB) INews

func (News) Update added in v2.3.117

func (s News) Update(ctx context.Context, id int, input NewsUpdateInput) error

type NewsCreateInput

type NewsCreateInput struct {
	Title   string
	Content *string
}

type NewsExport

type NewsExport struct {
	Title   string  `json:"title" csv:"title"`
	Content *string `json:"content" csv:"content"`
	UserID  int     `json:"user_id" csv:"user_id"`
}

type NewsExportInput added in v2.3.1

type NewsExportInput struct {
	Filter model2.Filter `json:"filter"`
}

type NewsImportDataInput

type NewsImportDataInput struct {
	Err     *string `json:"err,omitempty"`
	Title   string  `json:"title"`
	Content *string `json:"content"`
}

type NewsImportInput

type NewsImportInput struct {
	UserID int                   `json:"user_id"`
	Data   []NewsImportDataInput `json:"data"`
}

type NewsMassDeleteInput

type NewsMassDeleteInput struct {
	IDs []int `json:"ids"`
}

type NewsMassUpdateInput

type NewsMassUpdateInput struct {
	IDs     []int   `json:"ids"`
	Content *string `json:"content"`
}

type NewsUpdateInput

type NewsUpdateInput struct {
	Title   *string
	Content *string
}

type Services

type Services struct {
	News News
}

func NewServices

func NewServices(deps Deps) Services

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL