iferr:=store.DB.Preload("Topic").Where("channel_id = ? AND revision > ? AND id >= ?",channelSlot.Channel.ID,revision,begin).Find(&slots).Error;err!=nil{
ErrResponse(w,http.StatusInternalServerError,err)
return
}
}elseif!beginSet&&endSet{
iferr:=store.DB.Preload("Topic").Where("channel_id = ? AND revision > ? AND id < ?",channelSlot.Channel.ID,revision,end).Find(&slots).Error;err!=nil{
ErrResponse(w,http.StatusInternalServerError,err)
return
}
}elseifbeginSet&&endSet{
iferr:=store.DB.Preload("Topic").Where("channel_id = ? AND revision > ? AND id >= ? AND id < ?",channelSlot.Channel.ID,revision,begin,end).Find(&slots).Error;err!=nil{
ErrResponse(w,http.StatusInternalServerError,err)
return
}
}else{
iferr:=store.DB.Preload("Topic").Where("channel_id = ? AND revision > ?",channelSlot.Channel.ID,revision).Find(&slots).Error;err!=nil{
iferr:=store.DB.Preload("Topic.Assets").Where("channel_id = ? AND id < ?",channelSlot.Channel.ID,end).Order("id desc").Limit(count).Find(&slots).Error;err!=nil{
ErrResponse(w,http.StatusInternalServerError,err)
return
}
}
slots=reverseTopics(slots)
}elseifbeginSet&&!endSet{
iferr:=store.DB.Preload("Topic.Assets").Where("channel_id = ? AND id >= ?",channelSlot.Channel.ID,begin).Find(&slots).Error;err!=nil{
ErrResponse(w,http.StatusInternalServerError,err)
return
}
}elseif!beginSet&&endSet{
iferr:=store.DB.Preload("Topic.Assets").Where("channel_id = ? AND id < ?",channelSlot.Channel.ID,end).Find(&slots).Error;err!=nil{
ErrResponse(w,http.StatusInternalServerError,err)
return
}
}elseifbeginSet&&endSet{
iferr:=store.DB.Preload("Topic.Assets").Where("channel_id = ? AND id >= ? AND id < ?",channelSlot.Channel.ID,begin,end).Find(&slots).Error;err!=nil{