Skip to content

add convert arg to int#10

Open
zh3036 wants to merge 1 commit intocldwalker:mainfrom
zh3036:main
Open

add convert arg to int#10
zh3036 wants to merge 1 commit intocldwalker:mainfrom
zh3036:main

Conversation

@zh3036
Copy link

@zh3036 zh3036 commented Oct 6, 2024

when user provides a arg in
lq [query_name] [args]

prev behavior is to treat args as strings
now it attempts to convert to int when possible(and leaves it as it is when failed)

the change is useful when you want to have db-id as args

for example ,

 :lq/block-content
 {
     :query            [:find (pull ?b [*])
                        :in $ ?parent
                        :where
                        [?b :block/parent ?parent]]
     :inputs           [:parent]
 }

for this query i run run
lq block-content 1577

previously it finds nothing because it treats 1577 as "1577"
not it finds the content because it treats 1577 properly as db/id

when user provides a arg in 
lq [query_name] [args]

prev behavior is to treat args as strings
now it attempts to convert to int when possible(and leaves it as it is when failed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant