ai_scheduler/internal/biz/handle/dingtalk/option.go

37 lines
623 B
Go

package dingtalk
import "ai_scheduler/internal/data/model"
type Bot struct {
Id int
BotCode string
BotConfig *model.AiBotConfig
}
type BotOption func(*Bot)
func WithId(id int) BotOption {
return func(b *Bot) {
b.Id = id
}
}
func WithBotConfig(BotConfig *model.AiBotConfig) BotOption {
return func(bot *Bot) {
bot.BotConfig = BotConfig
}
}
func WithBotCode(BotCode string) BotOption {
return func(bot *Bot) {
bot.BotCode = BotCode
}
}
func WithBot(botSelf *Bot) BotOption {
return func(bot *Bot) {
bot.BotCode = botSelf.BotCode
bot.Id = botSelf.Id
bot.BotConfig = botSelf.BotConfig
}
}