You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
1.8 KiB
Go
79 lines
1.8 KiB
Go
package article
|
|
|
|
type ArticleDto struct {
|
|
EventId uint64 `json:"eventId"`
|
|
Title string `json:"title"`
|
|
Class string `json:"class"`
|
|
ReleaseDate string `json:"releaseDate"`
|
|
ReleaseTime string `json:"releaseTime"`
|
|
Stocks string `json:"stocks"`
|
|
Brief string `json:"brief"`
|
|
MainBoard int `json:"mainBoard"`
|
|
GrowthBoard int `json:"growthBoard"`
|
|
Content string `json:"content"`
|
|
Unlock bool `json:"unlock"`
|
|
}
|
|
|
|
func NewArticleDto(cfg ...articleDtoConfiguration) *ArticleDto {
|
|
articleDto := &ArticleDto{}
|
|
articleDtoConfigurations(cfg).apply(articleDto)
|
|
return articleDto
|
|
}
|
|
|
|
type articleDtoConfiguration func(*ArticleDto)
|
|
type articleDtoConfigurations []articleDtoConfiguration
|
|
|
|
func (cfg articleDtoConfigurations) apply(articleDto *ArticleDto) {
|
|
for _, c := range cfg {
|
|
c(articleDto)
|
|
}
|
|
}
|
|
|
|
func WithArticleDtoEventId(arg uint64) articleDtoConfiguration {
|
|
return func(dto *ArticleDto) {
|
|
dto.EventId = arg
|
|
}
|
|
}
|
|
|
|
func WithArticleDtoTitle(arg string) articleDtoConfiguration {
|
|
return func(dto *ArticleDto) {
|
|
dto.Title = arg
|
|
}
|
|
}
|
|
|
|
func WithArticleDtoClass(arg string) articleDtoConfiguration {
|
|
return func(dto *ArticleDto) {
|
|
dto.Class = arg
|
|
}
|
|
}
|
|
|
|
func WithArticleDtoReleaseDate(arg string) articleDtoConfiguration {
|
|
return func(dto *ArticleDto) {
|
|
dto.ReleaseDate = arg
|
|
}
|
|
}
|
|
|
|
func WithArticleDtoReleaseTime(arg string) articleDtoConfiguration {
|
|
return func(dto *ArticleDto) {
|
|
dto.ReleaseTime = arg
|
|
}
|
|
}
|
|
|
|
func WithArticleDtoStocks(arg string) articleDtoConfiguration {
|
|
return func(dto *ArticleDto) {
|
|
dto.Stocks = arg
|
|
}
|
|
}
|
|
|
|
func WithArticleDtoBrief(arg string) articleDtoConfiguration {
|
|
return func(dto *ArticleDto) {
|
|
dto.Brief = arg
|
|
}
|
|
}
|
|
|
|
func WithArticleDtoContent(arg string) articleDtoConfiguration {
|
|
return func(dto *ArticleDto) {
|
|
dto.Content = arg
|
|
}
|
|
}
|