https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
squarelibraries
  • m

    Marc Plano-Lesay

    04/28/2021, 4:26 AM
    Hi, I'm trying to understand the way Anvil scopes work, and not being entirely familiar with Dagger's scopes, I think I'm getting a bit confused. What I'm trying to achieve at the moment is: • An
    AppComponent
    that's a singleton, holding a few singletons, including a
    TaskRegistry
    • A
    TaskSubComponent
    , scoped to a
    TaskScope
    , declared through Anvil with
    @MergeSubcomponent(TaskScope::class)
    , which I think might be a mistake. A few classes are bound to this scope through
    @TaskScoped
    (the Dagger/javax.inject annotation) and
    @ContributesBinding(TaskScope::class
    Now in my
    TaskRegistry
    , I'm trying to instantiate tasks (which have a bunch of dependencies, all bound to
    TaskScope
    ). The way I'm trying to do this is by injecting in my
    TaskRegistry
    a
    Provider<TaskSubComponent>
    , and using this to instantiate new tasks. In my
    AppComponent
    , I'm declaring my sub-component as well (
    fun taskSubComponent(): TaskSubComponent
    ). At build-time, Dagger complains that it can't provide the sub-component as it doesn't have a binding. I thought that's what
    @MergeSubcomponent
    was basically achieving, but I'm clearly misunderstanding it. What I'm doing seems to be quite close to the
    LoggedInScope
    in the sample, but it doesn't seem to be used anywhere so I'm not really sure what's going on there... Does anyone have any hint/documentation other than the readme?
    r
    • 2
    • 8
  • r

    rkeazor

    05/03/2021, 8:37 PM
    What's the beat way to debug a code generator. Is there a way to attach a debugger?
    m
    • 2
    • 3
  • j

    John O'Reilly

    05/04/2021, 5:02 PM
    Am looking to enable use of IR compiler in a multiplatform module but running in to
    > Could not resolve com.squareup.sqldelight:coroutines-extensions:1.4.3.
    
    - Variant 'js-runtime' capability com.squareup.sqldelight:coroutines-extensions:1.4.3 declares a usage of 'kotlin-runtime' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js':
    - Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.js.compiler' with value 'legacy' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.js.compiler' with value 'ir'
    Not sure if there's plans to update to support IR (as per https://kotlinlang.org/docs/js-ir-compiler.html#authoring-libraries-for-the-ir-compiler-with-backwards-compatibility) ?
    • 1
    • 1
  • j

    jw

    05/04/2021, 5:06 PM
    looks like you need 1.4.4 https://github.com/cashapp/sqldelight/pull/1919/commits/e8d3eb5fd5dd10dcb7fbf594a9e77cc032cad32a
    👆 1
    👍 1
    j
    • 2
    • 1
  • a

    alec

    05/05/2021, 11:26 AM
    Agreed could probably have a better example
    m
    • 2
    • 4
  • n

    Nikola Milovic

    05/06/2021, 5:14 AM
    Hello everyone, quick question. I am trying to recreate this request in retrofit
    curl --location --request GET 'localhost:5000/api/657' \
    --form 'token="zjdW36WT0kkrlZHzjv3IpjysT9dA6QzK"
    All is fine until the --form part. As --form should be multipart data, which isn't allowed together with Get?
    Multipart can only be specified on HTTP methods with request body (e.g., @POST).
    c
    • 2
    • 2
  • e

    Elka

    05/10/2021, 7:00 PM
    Checking this hierarchical KMM issue for SqlDelight. I am creating a library which depends on SqlDelight and has the hierarchical project turned on. I cannot publish the module to a private maven repo because it fails to compile. Note that I want to support arm32 devices too. How would I apply the workaround mentioned in the issue comments if I need to support iosArm32?
    t
    • 2
    • 3
  • m

    myanmarking

    05/11/2021, 6:38 PM
    in sqldelight, is there any equivalent of room
    roomDatabase.invalidationTracker.addObserver(invalidator)
    ? I need to observe table changes, i don’t need the changed data or notifications, just to know
    a
    • 2
    • 3
  • k

    Kweku

    05/11/2021, 7:02 PM
    Is there anyway to set your database to a certain version and then migrate it for unit/ Integration tests. I'm currently trying to automatically populate my database at certain versions with queries generated from code. I unit tested it with JdbcSqliteDriver and it worked fine, but the android part of my app it didn't, which may be because i'm using AndroidSqliteDriver.Callback and overriding onUpgrade and may have done it incorrectly. The problem is that now I have no way to test if it works , i've tried using SupportSQLiteOpenHelper.Callback and passing version to it instead AndroidSqliteDriver.Callback but when I try to migrate using Schema.migrate onUpgrade isn't called and the version doesn't change, the version doesn't change with the JdbcSqliteDriver either but the data is inserted and selected correctly and the tests pass.
    • 1
    • 1
  • m

    myanmarking

    05/13/2021, 1:37 PM
    Why does generated code, for a column with a string returns Query<WrapperWithString> instead of Query<String?>. Any idea ?
    c
    • 2
    • 2
  • c

    Colton Idle

    05/20/2021, 4:56 AM
    On that same line of thinking, let's say that a request is made and my okhttp client has caching enabled. This initial request got a response with a max age header set to 1 year. Would a subsequent request to that same call show up in charles but the response of the second request would not? Or would we not even see the second request attempt to go over the network and so... absolutely nothing in charles for the subsequent request.
    y
    • 2
    • 2
  • j

    jean

    05/20/2021, 8:08 AM
    I tried to migrate my KM project to Sqldelight 1.5.0 but and now I can’t see all the gradle tasks that were available, I only see
    - generateCommonMainMyProjectDatabaseInterface
    - generateCommonMainMyProjectDatabaseSchema
    - generateSqlDelightInterface
    - verifyCommonMainMyProjectDatabaseMigration
    - verifySqlDelightMigration
    They all pass successfully but I can’t see anything generated (I invalidated my cache so
    build/sqldelight
    is empty). When I run the gradle
    build
    command, it fails on generated sqldelight class imports (since they are not build). What should I do from there to generate my sqldelight classes?
    a
    m
    • 3
    • 10
  • s

    saket

    05/24/2021, 3:12 AM
    what's the error you're seeing?
    c
    • 2
    • 1
  • x

    xxfast

    05/24/2021, 12:02 PM
    With SQLDelight - i’m getting this weird crash during code analysis. Not sure if this is something I did on my end, or something with the library. I’m following this guide
    • 1
    • 1
  • j

    jw

    05/24/2021, 4:42 PM
    js on node or browser? i believe the current release has a node-based, synchronous FS as a separate artifact
    a
    j
    • 3
    • 4
  • j

    jw

    05/24/2021, 4:42 PM
    the new filesystem API for browser JS is async and therefore incompatible with the current Okio design
    a
    • 2
    • 1
  • d

    Daniele B

    05/26/2021, 6:06 PM
    I am trying to use SqlDelight on a Compose for Desktop app. I am getting the driver like this:
    val sqlDriver = JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY)
    however when I make a DB operation, I get this error:
    Exception in thread "AWT-EventQueue-0 @coroutine#4" org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (no such table: Countries)
    full stacktrace in the comment (using
    com.squareup.sqldelight:sqlite-driver:1.5.0
    )
    a
    j
    n
    • 4
    • 15
  • j

    jw

    05/28/2021, 12:39 AM
    generally, emitting mutable objects is a big no-no.
    c
    • 2
    • 1
  • p

    Philip Dukhov

    05/29/2021, 7:21 PM
    I have a flow with ids, and I wanna to get flow of database objects. I’m trying to do it like this:
    indicesFlow
        .map { indices ->
            database.usersQueries
                .getBy(indices)
                .asFlow()
                .mapToList()
        }
        .flattenConcat()
        .collect { users ->
    
        }
    For some reason map gets called only for the first emitted item, and when I emit new indices to
    indexesFlow
    it’s not get called anymore and so collect it not get called too. I expect old database flow to be cancelled and be replaced with a new one. And if I replace database flow with a basic flow with emit, same code work fine for new indexesFlow emits
    indicesFlow
        .map { indices ->
            flow {
                emit("$indices")
            }
        }
        .flattenConcat()
        .collect { strings ->
    
        }
    I’m just starting exploring flows, what am I missing here?
    n
    m
    • 3
    • 5
  • r

    rudolf.hladik

    06/01/2021, 10:31 AM
    Hi, does the SQLDelight runtime version 1.6.0-SNAPSHOT depend on kotlin 1.5.0/1.5.10 ? https://oss.sonatype.org/#nexus-search;gav~com.squareup.sqldelight~runtime~~~~kw,versionexpand
    a
    • 2
    • 1
  • j

    jw

    06/02/2021, 1:26 AM
    I have models for the network layer which usually undergo slight transformation before insertion into the DB as arguments
    👍 1
    c
    • 2
    • 3
  • n

    Nikky

    06/04/2021, 8:48 AM
    i am using okio on
    mingwX64
    and it seems to work without issues via poweshell and cmd but when executed in gitbash things seem to fall apart i am getting
    Uncaught Kotlin exception: okio.IOException: Permission denied
    when calling
    filesystem.delete(command.reportFile.toPath())
    and
    Uncaught Kotlin exception: okio.FileNotFoundException: No such file or directory
    when calling
    val write: BufferedSink = fileSystem.appendingSink(command.reportFile.toPath()).buffer()
    command.reportFile
    is
    /c/Users/nikky/dev/kotlin-cli-starter/git-standup-report.txt
    the file exists and is writable:
    ls -la /c/Users/nikky/dev/kotlin-cli-starter/git-standup-report.txt
    -rw-r--r-- 1 nikky 197121 407 Jun  4 10:41 /c/Users/nikky/dev/kotlin-cli-starter/git-standup-report.txt
    j
    • 2
    • 5
  • d

    dave08

    06/14/2021, 10:20 AM
    Hi! I'm getting a funny error when adding the Anvil plugin (this is a Ktor server-side service). I pasted it in the thread...
    r
    • 2
    • 11
  • e

    einar

    06/18/2021, 12:24 PM
    Is there a way to conditionally alter a table column in a SQLDelight migration file? So, if column
    id
    exists, rename it to
    userId
    but otherwise don’t.
    m
    • 2
    • 5
  • m

    Mohit Khanna

    06/21/2021, 8:56 PM
    Hello, I have a query about using SQLDelight in prod. I asked this on SO (here) as well, and @kpgalligan shared interesting reply. (Thanks Kevin!) But I'm just trying to ask it here again just to get some more understanding.. Can someone share: 1. Why SqlDelight runtime is marked as Experimental (see here ) ? Any timeline on when it would be marked stable? 2. Are there any particular components/features of SqlDelight that we should be careful around (experimental?) 3. Any known prod crashes that could concern typical CRUD usage ? 4. Any benchmarking results that could help us evaluate perf risks? More specifically, we are considering migrating our code to KMM and as part of that we are evaluating how safe SQLDelight would be in prod as it is currently marked experimental. Thanks!
    🆙 1
    • 1
    • 1
  • d

    dave08

    06/23/2021, 1:18 PM
    With Anvil's
    generateDaggerFactories.set(true)
    , IDEA Ultimate doesn't seem to know where the module classes are and can't navigate to them from the generated component (even though they're there and everything works...), whereas when using dagger generated modules it does. Is there any way to get intellij to know where these files are (and not make all my components red...)?
    r
    • 2
    • 5
  • d

    dave08

    06/23/2021, 1:21 PM
    Also, how do I use gradle kotlin dsl to enable
    generateDaggerFactories.set(true)
    only when not compiling the module for tests (I declare a component in the tests but not in the main module's code)? I noticed the
    variantFilter
    I just don't see how it works...?
    r
    • 2
    • 2
  • j

    jw

    06/25/2021, 7:46 PM
    no sqldelight release this week. we're trying to land linuxX64 and then it'll go out.
    :thank-you: 2
    ❤️ 1
    👍 7
    p
    • 2
    • 8
  • a

    alec

    06/28/2021, 11:45 AM
    You shouldn’t have to add the kotlin compile dependency, and gradle cache should be working on 1.5.0 but it was broken before that
    👍 1
    j
    • 2
    • 1
  • c

    Colton Idle

    07/02/2021, 1:40 AM
    It's a stretch... but I just encountered a dependency issue because I included mock webserver into my internal builds. Basically due to hamcrest and junit being pulled in. Any chance to get a mock webserver without those deps?
    e
    j
    y
    • 4
    • 8
Powered by Linen
Title
c

Colton Idle

07/02/2021, 1:40 AM
It's a stretch... but I just encountered a dependency issue because I included mock webserver into my internal builds. Basically due to hamcrest and junit being pulled in. Any chance to get a mock webserver without those deps?
e

ephemient

07/02/2021, 5:35 AM
https://github.com/square/okhttp/issues/6720
j

jessewilson

07/02/2021, 11:20 AM
https://square.github.io/okhttp/changelog/#version-500-alpha2
c

Colton Idle

07/02/2021, 1:40 PM
Oh heck yeah. Glad to see I'm not the only one and glad to see it's not a huge red flag to ship this as an apps local http server. Thank you everyone!
FWIW When on https://square.github.io/okhttp/ and clicking the square in the upper left, you get taken to a 404. Also @jessewilson would happen to know if it's okay to just update okhttp-mockwebserver to 5.0+ or do I need to update okhttp, okio, logging-interceptor, etc?
j

jessewilson

07/02/2021, 2:10 PM
you gotta update all the okhttp things together
c

Colton Idle

07/02/2021, 2:23 PM
Okay. I'll do that but leave okio on stable. Thank you!
y

yschimke

07/06/2021, 2:41 PM
OkHttp 5 alpha uses Okio 3 alpha features
Like file system
View count: 10