package DBIx::Struct::JSON::Array;
use strict;
use warnings;
sub TIEARRAY {
bless [$_[1], $_[2], $_[3]], $_[0];
}
sub FETCHSIZE {
scalar @{$_[0][0]};
}
sub STORESIZE {
$_[0][1]{$_[0][2]
->[1]{$ob->[2]} = undef;
return splice(@{$ob->[0]}, $off, $len, @_);
}
package DBIx::Struct::JSON::Hash;
use strict;
use warnings;
sub TIEHASH {
bless [$_[1], $_[2], $_[3]], $_[0];
}
sub ST
ruct::JSON;
use strict;
use warnings;
use JSON;
sub factory {
my ($class, $value_ref, $update_hash, $hash_key) = @_;
my $self;
if (not ref $$value_ref) {
my $jv = from_json($$val
use it usually.
But sometimes you have to help Perl to understand that deeply located
element of JSON hash or array was actually updated.
=head3 C<delete>
Deletes the row or rows from the table.
=
al update in table.
=head4 B<JSON> output support
Every row-object has C<TO_JSON()> function that can be automatically used
by C<JSON> C<encode> function. This C<TO_JSON()> has some flexibility what
BC::Users->findOneByUsername("cruks");
my $json = JSON->new->convert_blessed;
# please pay attention on "id", its value is of number type
print $json->encode($user); # {"username":"cruks","id":1