NAME

DBIO::HashAccessor - Accessor methods for serialized hash columns

VERSION

version 0.900000

SYNOPSIS

__PACKAGE__->load_components(
  'HashAccessor',
  'InflateColumn::Serializer',
);

__PACKAGE__->table('data');

__PACKAGE__->add_columns(
  'data' => {
    'data_type' => 'VARCHAR',
    'size' => 255,
    'serializer_class' => 'JSON',
  }
);

__PACKAGE__->add_hash_accessor( da => 'data' );

In code:

print $result->da_exists('key') ? 1 : 0; # exists
$result->da('key',$new_value); # set
print $result->da('key'); # get
$result->da_delete('key'); # delete
$result->da_hash('hash','key',22); # set inside hash
print $result->da_hash('hash','key'); # get inside hash
$result->da_hash_delete('hash','key'); # delete inside hash
$result->da_push('array',@elements); # add to array
$result->da_shift('array'); # shift from array
$result->da_in('array',$value); # value is in array
$result->da_in_delete('array',$value); # find and delete value in array

DESCRIPTION

Generates convenience accessor methods for serialized hash columns. Designed to be used alongside DBIO::InflateColumn::Serializer. Call add_hash_accessor with a prefix and column name, and it installs get/set, exists, delete, nested hash, and array manipulation methods.

Based on DBIx::Class::HashAccessor by GETTY.

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.