The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Plack::App::ServiceStatus::DBI - Check DBI connection

VERSION

version 0.909

SYNOPSIS

my $conn       =  DBI->connect( ... );
my $status_app = Plack::App::ServiceStatus->new(
    app => 'your app',
    DBI => $dbh
);

CHECK

Uses a DBI $dbh to execute a query, per default select 1;. This query has to return 1 to indicate that everything is ok.

You can pass another query when loading Plack::App::ServiceStatus:

my $status_app = Plack::App::ServiceStatus->new(
    app           => 'your app',
    DBIxConnector => [ $dbh, '
      SELECT CASE
          WHEN count(*) > 0 THEN 1
          ELSE 0
      END
      FROM some_table'
    ],
);

AUTHOR

Thomas Klausner <domm@plix.at>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 - 2022 by Thomas Klausner.

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