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

not_null shortcut #44

Closed
moltar opened this issue Mar 12, 2015 · 13 comments
Closed

not_null shortcut #44

moltar opened this issue Mar 12, 2015 · 13 comments

Comments

@moltar
Copy link
Contributor

moltar commented Mar 12, 2015

What do you think about having a not_null shortcut?

Example from my own use:

=head2 not_null($column)

Ensure that given C<$column> is not null.

=cut

sub not_null {
    my ($self, $column) = @_;

    return $self->search_rs({ $self->me($column) => { '!=' => undef } });
}
@frioux
Copy link
Owner

frioux commented Mar 12, 2015

Seems legit to me; should we make a null, like, and not_like too while we're at it?

@wesQ3 thoughts?

@wesQ3
Copy link
Collaborator

wesQ3 commented Mar 12, 2015

Sounds good. We're probably overdue for some search condition shortcuts rather than just smoothing out search attributes.

@frioux
Copy link
Owner

frioux commented Mar 12, 2015

@moltar if you send a PR with docs and tests (you're halfway there!) I'll look at merging it. Otherwise this'll go on the stack and I'll release it before too long.

@moltar
Copy link
Contributor Author

moltar commented Mar 12, 2015

Should each go into a separate package or do we bundle them into some namespace, like SearchShortcuts?

@frioux
Copy link
Owner

frioux commented Mar 12, 2015

Good question. I think that each one should be a separate package, but they should all be used in SearchShortcuts. That way if the user wants everything they just use SearchShortcuts but if they want to not use a few they can do that.

@moltar
Copy link
Contributor Author

moltar commented Mar 13, 2015

Another question. Should be prefix them with "me." via ->me method or should we leave this exercise up to the user?

@frioux
Copy link
Owner

frioux commented Mar 13, 2015

Do what I did in datemethods! If the user does .foo, prefix; if the user does just foo, leave it alone.

@moltar
Copy link
Contributor Author

moltar commented Mar 27, 2015

So I was trying to figure out what the best name space would be. My proposition is:

DBIx::Class::Helper::ResultSet::Shortcut::Search::$NAME

And then just load them up in DBIx::Class::Helper::ResultSet::Shortcut with all the other ones?

Or do we want them to load separately?

@frioux
Copy link
Owner

frioux commented Mar 27, 2015

Yeah that namespace sounds perfect, just load it into Shortcut

sent from a rotary phone, pardon my brevity
On Mar 27, 2015 10:20 AM, "moltar" notifications@github.com wrote:

So I was trying to figure out what the best name space would be. My
proposition is:

DBIx::Class::Helper::ResultSet::Shortcut::Search::$NAME

And then just load them up in DBIx::Class::Helper::ResultSet::Shortcut
with all the other ones?

Or do we want them to load separately?


Reply to this email directly or view it on GitHub
#44 (comment)
.

@moltar
Copy link
Contributor Author

moltar commented May 16, 2015

Added in #47

@frioux
Copy link
Owner

frioux commented May 17, 2015

This looks good @moltar. Could you remove the headers from the methods that already have POD documentation? The ones for private methods are fine. Thanks!

@moltar
Copy link
Contributor Author

moltar commented May 17, 2015

Done.

@frioux
Copy link
Owner

frioux commented May 24, 2015

released!

@frioux frioux closed this as completed May 24, 2015
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

3 participants