https://kotlinlang.org logo
#ktor
Title
# ktor
t

tjohnn

04/25/2019, 7:02 PM
Documentation on
invoke()
warned against overusing it, right now I am using it for all my uses cases e.g
Copy code
class CreateNewSubCategory @Inject constructor(private val subcategoryRepository: SubCategoryRepository){
    suspend operator fun invoke(category: Subcategory): Int = subcategoryRepository.createSubCategory(category)
}
Is there any detriment to that?
d

Dominaezzz

04/25/2019, 7:08 PM
If you do
s/CreateNewSubCategory/SubCategoryFactory/
then I think that's fine.
t

tjohnn

04/25/2019, 7:17 PM
Sorry I don't understand, I am using guice to inject the usecases directly into my controller and calling
useCaseName()
for example whenever I need it
d

Dominaezzz

04/25/2019, 7:18 PM
Rename
CreateNewSubCategory
to
SubCategoryFactory
.
t

tjohnn

04/25/2019, 7:28 PM
Okay thanks, though CreateNewSubCategory is a usecase, not a factory