NAME

Neo4j::Types::Generic - Generic Neo4j type implementations

VERSION

version 2.00

OVERVIEW

The Neo4j::Types distribution includes generic implementations of some Neo4j property types. This enables users to easily create values of these types locally, for example to pass these back to Neo4j in a query parameter.

Neo4j drivers may provide similar packages, which might be better optimised for use with the respective driver. As long as each of them conforms to the appropriate interface from Neo4j::Types, they should all be interchangeable.

ByteArray

Neo4j::Types::Generic::ByteArray offers the following method in addition to the one defined in Neo4j::Types::ByteArray.

new

$bytearray = Neo4j::Types::Generic::ByteArray->new( $bytes );

Create a new generic Neo4j byte array value. The parameter $bytes is expected to be a scalar string.

DateTime

Neo4j::Types::Generic::DateTime offers the following methods in addition to those defined in Neo4j::Types::DateTime.

new

$dt = Neo4j::Types::Generic::DateTime->new({
  days        => $days,
  seconds     => $seconds,
  nanoseconds => $nanoseconds,
  tz_offset   => $offset_seconds,
  tz_name     => $iana_tz_name,
});
$dt = Neo4j::Types::Generic::DateTime->new( $epoch );
$dt = Neo4j::Types::Generic::DateTime->new( $epoch, $tz );

Create a new generic temporal instant value. For the description of the parameters, see "METHODS" in Neo4j::Types::DateTime. The type of the value will be intrinsically defined by the parameters you provide.

Instead of giving the parameters hash ref, you can alternatively give the Unix epoch with or without time zone identification. This will always create a LOCAL DATETIME or ZONED DATETIME value, as appropriate. If $tz begins with a letter, it will be treated as an IANA Olson time zone database entry name; if it begins with a digit or a sign, it will be treated as an offset in seconds.

Duration

Neo4j::Types::Generic::Duration offers the following methods in addition to those defined in Neo4j::Types::Duration.

new

$dt = Neo4j::Types::Generic::Duration->new({
  months      => $months,
  days        => $days,
  seconds     => $seconds,
  nanoseconds => $nanoseconds,
});

Create a new generic temporal duration value. For the description of the parameters, see "METHODS" in Neo4j::Types::Duration. Missing parameters will be assumed to have the value 0.

Point

Neo4j::Types::Generic::Point offers the following methods in addition to those defined in Neo4j::Types::Point.

height

$value = $point->height;

Alias for Z().

latitude

$value = $point->latitude;

Alias for Y().

longitude

$value = $point->longitude;

Alias for X().

new

$point = Neo4j::Types::Generic::Point->new($neo4j_srid, @coordinates);

Creates a new generic Point instance with the specified value.

This method will fail if the SRID provided is not supported by Neo4j or if it requires a greater number of coordinates than provided. See "srid" in Neo4j::Types::Point.

X

$value = $point->X;  # uppercase X

Retrieve the point's first ordinate, also known as the abscissa. Commonly used for the horizontal axis in an Euclidean plane or for the geographical longitude.

Y

$value = $point->Y;  # uppercase Y

Retrieve the point's second ordinate. Commonly used for the vertical axis in an Euclidean plane or for the geographical latitude.

Z

$value = $point->Z;  # uppercase Z

Retrieve the point's third ordinate. Commonly used for height.

For points in coordinate systems that have no more than two dimensions, this method returns undef.

SEE ALSO

AUTHOR

Arne Johannessen <ajnn@cpan.org>

If you contact me by email, please make sure you include the word "Perl" in your subject header to help beat the spam filters.

COPYRIGHT AND LICENSE

This software is Copyright (c) 2021-2023 by Arne Johannessen.

This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0 or (at your option) the same terms as the Perl 5 programming language system itself.