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

fix: add count_by #40

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

fix: add count_by #40

wants to merge 16 commits into from

Conversation

asyncmind0
Copy link

  • use sumo_utils:is_datetime
  • hanndle undefined values

- use sumo_utils:is_datetime
- hanndle undefined values
@elbrujohalcon elbrujohalcon requested a review from cabol March 16, 2020 10:52
count_by(DocName, [], State) ->
count(DocName, State);
count_by(_DocName, _Conditions, #{conn := _Conn} = _State) ->
0.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should only have 2 spaces for indentation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this function to the API section; below count.

On the other hand, I don't really see the point of having this function, at least I don't see specific logic with the conditions, for example, if condition list if empty, bypass to count(DocName, State), otherwise return 0. This looks to me like a very specific logic. Could you please elaborate more on this, what is the purpose of having this function implemented in this way? What if we have conditions, should we perform the count query based on the conditions?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currrrently I'm just getting the code to compile and run, I'm not sure how to implement a count_by in the context, maybe I could do a search and get the count ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currrrently I'm just getting the code to compile and run, I'm not sure how to implement a count_by in the context, maybe I could do a search and get the count ?

Sorry, I cannot help much here since I haven't worked with Riak a long time ago, but I'd review RiakKV doc and see what would be the best way for implementing this, maybe investigate if there are examples or other cases where this has been implemented already.

Once you have some implementation done, we can review it! Looking forward to that 😉

Copy link
Member

@elbrujohalcon elbrujohalcon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be fair… it's been a long time since we did a proper round of maintenance around inaka projects and that's why none of them use any formatter, or hank, or any other new rebar3 plugin. But, if we're going to start adding those things, we'll always try to use first the ones that we developed and/or choose the ones that are more flexible.


%% == Plugins ==

{plugins, [steamroller]}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is an inaka project, on principle, we should use rebar3_format instead of steamroller.
In any case, you can either…

  • Fork the project and use steamroller on your fork.
  • Use rebar3_format with a profile for you that uses the sr_formatter formatter (that one formats the code with steamroller).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't aware of rebar3_format, let me check it out, Thanks

Copy link
Member

@elbrujohalcon elbrujohalcon Sep 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is totally off-topic, but it's something that I always wonder about…
As a maintainer of multiple open-source tools for the Erlang community (and a blog), I'm always trying to reach as many Erlang devs as possible with the news.
So, 100% out of curiosity and not as a criticism: If you didn't know about rebar3_format but you knew about steamroller… How do you get your news about Erlang and its ecosystem? What communication channel am I missing?
I mean… as far as I know, @dtip published steamroller in exactly the same places I published rebar3_format (sometimes even I was the one publishing his work). So… If you don't mind… What did I miss? How can I improve the broadcasting of news about the tools I create/maintain?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be because I searched for "opinionated code formatter for erlang"
coming from python as a python dev, I discovered the comfort of black for python
wanted the same for Erlang

Mostly I'm searching for concepts parallel to python

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opinionated formatters are the right choice 😉

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:trollface:

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.

4 participants