Fork me on GitHub
#pathom
<
2021-07-10
>
fabrao00:07:51

hello all, what is the difference using : or :: ?

fabrao00:07:20

for key difinition?

lsenjov00:07:40

:foo resolves to :foo, ::foo resolves to :*ns*/foo

lsenjov00:07:58

So if you're in the bar.baz namespace, then ::foo resolves to :bar.baz/foo

lsenjov00:07:52

It also allows aliasing, so if you have the alias [bar.baz :as b] then ::b/foo resolves to :bar.baz/foo

fabrao00:07:10

so how do I query this?

(pc/defresolver cursos-alura [env _]
                {::pc/output [{::cursos-alura [:curso/id]}]}
                {::cursos-alura [{:curso/id 1}
                                 {:curso/id 2}]})

lsenjov00:07:28

What namespace is it in?

fabrao00:07:37

is it matter?

fabrao00:07:47

(parser {} [{::cursos-alura [:curso/id]}]) does not work

lsenjov00:07:52

...yes, that's the point I'm getting at

lsenjov00:07:57

What namespace is the defresolver in?

fabrao00:07:11

aplicacao.resolvers.alura.cursos

lsenjov00:07:29

Then it's :aplicacao.resolvers.alura.cursos/cursos-alura

lsenjov00:07:53

Or ::cursos/cursos-alura if you set up a cursos alias

fabrao00:07:06

understando, let me try here

fabrao00:07:50

(parser {} [{::cursos/cursos-alura [:curso/id]}])

fabrao00:07:57

{:aplicacao.resolvers.alura.cursos/cursos-alura [{:curso/id 1} {:curso/id 2}]}

fabrao00:07:15

no way to resolve with alias?

lsenjov00:07:14

Have you set up an alias for cursos in your ns declaration?

fabrao00:07:52

in registry I used [aplicacao.resolvers.alura.cursos :as cursos]

fabrao00:07:24

so, yes I used it

lsenjov00:07:24

Wait, that looks like it's resolving fine?

fabrao01:07:19

I thougth that response shoud be {:cursos/cursos-alura [{:curso/id 1} {:curso/id 2}]}

lsenjov01:07:50

No, ::cursos/cursos-alura literally equals :aplicacao.resolvers.alura.cursos/cursos-alura

fabrao01:07:14

yes sure, but is there any way to use the alias?

lsenjov01:07:29

The :: makes it resolve the namespace

lsenjov01:07:52

::cursos/ resolves the namespace, and does not equal :cursos/

fabrao01:07:35

if I use it with the same namespace as the registry?

lsenjov01:07:34

I'm not sure I follow what you're trying to achieve

lsenjov01:07:52

If you want it to be :cursos/cursos-alura, then you should make that the key of your defresolver

fabrao01:07:57

I want to be like this

fabrao01:07:18

"If you want it to be `:cursos/cursos-alura`, then you should make that the key of your `defresolver` " -> Understood

fabrao01:07:10

@lsenjov Thank you

👍 3
fabrao01:07:05

how do I pass parameter in eql query?

fabrao01:07:46

I saw this [(::instruments {:sort :instrument/brand})] but it does not work

wilkerlucio02:07:56

when running from Clojure you need to quote it, otherwise it tries to invoke the keyword: ['(::instruments {:sort :instrument/brand})]

fabrao02:07:36

ohhhhhhhhhhhhhhhhhhhhhuuuu

fabrao02:07:10

I´m a dumb guy

fabrao02:07:30

thank you @U066U8JQJ

👍 3
fabrao01:07:18

giving me Invalid excpression

Björn Ebbinghaus19:07:43

How much work is it to migrate from v2 to v3?

wilkerlucio21:07:37

depends on what you use from Pathom 2, resolvers are mostly compatible (in terms of definition, the major difference is that inputs are now EQL instead of sets). plugins also require change. I'm going to start working on a "portability library" this week, I wanna see how automatically we can make it, the idea is to have a different namespace that you require and you use the same Pathom 2 interface to use Pathom 3 implementation