-
-
Save ology/ca12cb804b87f04b4397405e2bb58bbb to your computer and use it in GitHub Desktop.
db->select(...) only returning one record?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sqlite> select * from moog_matriarch; | |
1|{"bottom":20,"control":"knob","group":"filter","is_default":1,"parameter":"cutoff","top":20000,"unit":"Hz","value":200}|Test setting! | |
2|{"bottom":0,"control":"patch","group":"modulation","is_default":1,"parameter":"wave out","top":1,"unit":"boolean","value":1}|Test setting! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub recall_settings { | |
my ($self, %args) = @_; | |
my $name = delete $args{name}; | |
croak 'No name given' unless $name; | |
my $settings = $self->_sqlite->select( | |
$self->model, | |
['settings'], | |
{ name => $name }, | |
)->expand(json => 'settings')->array; | |
return $settings; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subtest settings => sub { | |
my $name = 'Test setting!'; | |
... | |
my $settings = $obj->recall_settings(name => $name); | |
use Data::Dumper::Compact qw(ddc); | |
warn __PACKAGE__,' L',__LINE__,' ',ddc($settings); | |
--> | |
main L74 [ { | |
bottom => 20, | |
control => 'knob', | |
group => 'filter', | |
is_default => 1, | |
parameter => 'cutoff', | |
top => 20000, | |
unit => 'Hz', | |
value => 200, | |
} ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment