Database-BI

 view release on metacpan or  search on metacpan

lib/Database/BI/Model/DataSource.pm  view on Meta::CPAN


    SCALAR integer   # Unix epoch seconds, e.g. 1728601234
    undef            # URL-backed tables, or file cannot be stat()-ed

=head3 MESSAGES

None.

=cut

sub updated {
	my $self = shift;
	# Delegate to the D::A backend when available -- it tracks mtime internally.
	return $self->{_db}->updated() if $self->{_db} && $self->{_db}->can('updated');
	# Fallback: stat the file path directly (header-less CSV and XLSX bypass D::A).
	return (stat($self->{_file_path}))[9] if defined $self->{_file_path} && -f $self->{_file_path};
	return undef;
}

# ---------------------------------------------------------------------------
# Public data-access methods

t/redis.t  view on Meta::CPAN

	sub new {
		my ($class, %args) = @_;
		return bless {
			_cols => $args{cols} // [],
			_rows => $args{rows} // [],
		}, $class;
	}

	sub columns { return $_[0]->{_cols} }
	sub schema  { return {} }
	sub updated { return 1 }
	sub set_logger { return $_[0] }

	sub selectall_arrayref {
		my ($self, $criteria) = @_;
		my @rows = @{ $self->{_rows} };
		for my $col (CORE::keys %{ $criteria // {} }) {
			my $val = $criteria->{$col};
			next if ref $val;
			@rows = grep { defined $_->{$col} && $_->{$col} eq $val } @rows;
		}

t/redis_live.t  view on Meta::CPAN

	sub new {
		my ($class, %args) = @_;
		return bless {
			_cols => $args{cols} // [],
			_rows => $args{rows} // [],
		}, $class;
	}

	sub columns { return $_[0]->{_cols} }
	sub schema  { return {} }
	sub updated { return 1 }
	sub set_logger { return $_[0] }

	sub selectall_arrayref {
		my ($self, $criteria) = @_;
		my @rows = @{ $self->{_rows} };
		for my $col (CORE::keys %{ $criteria // {} }) {
			my $val = $criteria->{$col};
			next if ref $val;
			@rows = grep { defined $_->{$col} && $_->{$col} eq $val } @rows;
		}



( run in 0.483 second using v1.01-cache-2.11-cpan-7da0f45c409 )