Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multi-arity fn in protocols #267

Closed
yogsototh opened this issue Jul 5, 2017 · 2 comments
Closed

Support multi-arity fn in protocols #267

yogsototh opened this issue Jul 5, 2017 · 2 comments

Comments

@yogsototh
Copy link

I stumble upon the following error:

Incorrect macro usage: service functions must be defined the same as a call to `reify`, eg: `(my-service-fn [this other-args] ...)`

When trying to implement a service for a protocol like the following:

(defprotocol SearchStoreService
  (search
    [this db pattern]
    [this db pattern options]))

(tk/defservice search-store-service
  SearchStoreService
  [[:ConfigService get-in-config]]

   ...

(search
   ([this db pattern]
    (search db pattern nil))
   ([this db pattern options]
    (if-let [db-conf (get-in (service-context this) [:stores db])]
      (core/search db-conf pattern options)
      (log/errorf "Unknown db (%s)" db))))
@cprice404
Copy link

@yogsototh
Copy link
Author

yogsototh commented Jul 5, 2017

My bad, I didn't used the same syntax.

Thanks!

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

No branches or pull requests

2 participants