Search code examples
kotlin-multiplatformkotlin-multiplatform-mobilesqldelight

Should I use my package name for KMM SqlDelight config?


I am following this guide and in the first section of this step I have to do the following:

 sqldelight {
    database("AppDatabase") {
        packageName = "com.jetbrains.handson.kmm.shared.cache"
    }
}

Question is, should I use .handson. or .myPackageName. and why?


Solution

  • As guide from your link says

    The packageName parameter specifies the package name for the generated Kotlin sources.

    As with any kotlin file, you can specify any package name you want, but a good practice is to put all the files in the same module under the module package.

    Let's say your module has the package name com.app.modules.shared. You can use the same package name for the generated database or some sub-path such as com.app.modules.shared.database.