NAME
GrowthForecast::Aggregator::Declare - Declarative interface for
GrowthForecast client
SYNOPSIS
use GrowthForecast::Aggregator::Declare;
my @queries = gf {
section member => sub {
# post to member/count
db(
name => 'count',
description => 'The number of members',
query => 'SELECT COUNT(*) FROM member',
);
};
section entry => sub {
# post to entry/count, entry/count_unique
db_multi(
names => ['count', 'count_unique'],
descriptions => ['Total count of posts', 'Posted bloggers'],
query => 'SELECT COUNT(*), COUNT(DISTINCT member_id) FROM entry',
);
};
};
for my $query (@queries) {
$query->run(
dbh => $dbh,
ua => $ua,
service => 'blog_service',
endpoint => '
http://exapmle.com/api/',
);
}
DESCRIPTION
GrowthForecast::Aggregator::Declare is a declarative client library for
GrowthForecast
DSL
gf { ... }
This makes a scope to declare GrowthForecast metrics.
This function returns list of Aggregators.
section $name:Str, \&block
section 'member' => sub { ... };
This function defines section. Under this function, db() and
db_multi() function use the section name automatically.
db(%args)
Create GrowthForecast::Aggregator::DB object using %args.
db_multi(%args)
Create GrowthForecast::Aggregator::DBMulti object using %args.
AUTHOR
Tokuhiro Matsuno <tokuhirom AAJKLFJEF@ GMAIL COM>
SEE ALSO
This library is client for GrowthForecast.
LICENSE
Copyright (C) Tokuhiro Matsuno
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.