Elastic-Model
view release on metacpan or search on metacpan
lib/Elastic/Model/Types.pm view on Meta::CPAN
#===================================
class_type UID, { class => 'Elastic::Model::UID' };
#===================================
coerce UID, from Str, via { Elastic::Model::UID->new_from_string($_) };
coerce UID, from HashRef, via { Elastic::Model::UID->new($_) };
1;
=pod
=encoding UTF-8
=head1 NAME
Elastic::Model::Types - MooseX::Types for general and internal use
=head1 VERSION
version 0.52
=head1 SYNOPSIS
use Elastic::Model::Types qw(GeoPoint);
has 'point' => (
is => 'ro',
isa => GeoPoint,
coerce => 1
);
=head1 DESCRIPTION
Elastic::Model::Types define a number of L<MooseX::Types>, some for internal
use and some which will be useful generally.
=head1 PUBLIC TYPES
=head2 Keyword
use Elastic::Model::Types qw(Keyword);
has 'status' => (
is => 'ro',
isa => Keyword
);
C<Keyword> is a sub-type of C<Str>. It is provided to make it easy to map
string values which should not be analyzed (eg a C<status> field rather than
a C<comment_body> field). See L<Elastic::Model::TypeMap::ES/Keyword>.
=head2 Binary
use Elastic::Model::Types qw(Binary);
has 'binary_field' => (
is => 'ro',
isa => Binary
);
Inherits from the C<Defined> type. Is automatically Base64 encoded/decoded.
=head2 GeoPoint
use Elastic::Model::Types qw(GeoPoint);
has 'point' => (
is => 'ro',
isa => GeoPoint,
coerce => 1,
);
C<GeoPoint> is a hashref with two keys:
=over
=item *
C<lon>: a C<Number> between -180 and 180
=item *
C<lat>: a C<Number> between -90 and 90
=back
It can be coerced from an C<ArrayRef> with C<[$lon,$lat]> and from a
C<Str> with C<"$lat,$lon">.
=head2 Timestamp
use Elastic::Model::Types qw(Timestamp);
has 'timestamp' => (
is => 'ro',
isa => Timestamp
);
A C<Timestamp> is a C<Num> which holds floating point epoch seconds, with milliseconds resolution.
It is automatically mapped as a C<date> field in Elasticsearch.
=head1 AUTHOR
Clinton Gormley <drtech@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2015 by Clinton Gormley.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
__END__
# ABSTRACT: MooseX::Types for general and internal use
( run in 1.426 second using v1.01-cache-2.11-cpan-df04353d9ac )