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

Add select_row_as and select_all_as features #19

Merged
merged 1 commit into from Oct 10, 2023

Conversation

kfly8
Copy link
Contributor

@kfly8 kfly8 commented Oct 6, 2023

This pull request adds select_row_as and select_all_as methods. These methods are shortcuts to create models like this:

class User {
  field $name :param
}

# BEFORE
my $user_row = $dbh->select_row('SELECT * FROM users LIMIT 1');
unless ($user_row) {
   return NOT_FOUND
}
my $user = User->new($user_row->%*);

# AFTER
my $user = $dbh->select_row_as('User', 'SELECT * FROM users LIMIT 1');
unless ($user) {
   return NOT_FOUND
}

Could you please add it?

@kazeburo kazeburo merged commit 1d24557 into kazeburo:master Oct 10, 2023
0 of 3 checks passed
@kfly8 kfly8 deleted the row_as branch October 10, 2023 07:09
kazeburo added a commit that referenced this pull request Oct 14, 2023
Changelog diff is:

diff --git a/Changes b/Changes
index b745fa7..e19c886 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,11 @@ Revision history for Perl extension DBIx::Sunny
 
 {{$NEXT}}
 
+0.9993 2023-10-14T08:38:01Z
+
+        - Add select_row_as and select_all_as features #19
+
+
 0.9992 2020-07-29T23:32:14Z
 
         - Croak when mismatch of bind values #17
@kazeburo
Copy link
Owner

released 0.9993. Thank you.

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.

None yet

2 participants