package service import ( "errors" "main_program/common" "main_program/entity" ) type channelService struct{} var ChannelService channelService func (c *channelService) QueryOneByChannelId(channelId string) (channel entity.Channel, err error) { var channelEntity entity.Channel result := common.MysqlDB.Where(&entity.Channel{ChannelId: channelId}).First(&channelEntity) if result.Error != nil { return channelEntity, errors.New("query channel error") } else { return channelEntity, nil } }