Zing::Cursor - Lookup Table Traversal
Lookup Table Traversal Construct
use Zing::Lookup; use Zing::Cursor; my $lookup = Zing::Lookup->new(name => 'users'); $lookup->set('user-12345')->set(username => 'u12345'); $lookup->set('user-12346')->set(username => 'u12346'); $lookup->set('user-12347')->set(username => 'u12347'); my $cursor = Zing::Cursor->new(lookup => $lookup); # $cursor->count;
This package provides a cursor for traversing Zing::Lookup indices and supports forward and backwards traversal as well as token-based pagination.
This package uses type constraints from:
Zing::Types
This package has the following attributes:
lookup(Lookup)
This attribute is read-only, accepts (Lookup) values, and is required.
(Lookup)
position(Maybe[Str])
This attribute is read-write, accepts (Maybe[Str]) values, and is optional.
(Maybe[Str])
This package implements the following methods:
count() : Int
The count method returns the number of Zing::Domain objects in the lookup table.
# given: synopsis $cursor->count;
fetch(Int $size = 1) : ArrayRef[Domain]
The fetch method returns the next n Zing::Domain objects from the lookup table.
n
# given: synopsis $cursor->fetch;
# given: synopsis $cursor->fetch(5);
first() : Maybe[Domain]
The first method returns the first Zing::Domain object created in the lookup table.
# given: synopsis $cursor->first;
last() : Maybe[Domain]
The last method returns the last Zing::Domain object created in the lookup table.
# given: synopsis $cursor->last;
next() : Maybe[Domain]
The next method returns the next (after the current position) Zing::Domain object in the lookup table.
# given: synopsis $cursor->next;
# given: synopsis $cursor->next; $cursor->next;
prev() : Maybe[Domain]
The prev method returns the prev (before the current position) Zing::Domain object in the lookup table.
# given: synopsis $cursor->prev;
# given: synopsis $cursor->prev; $cursor->prev;
reset() : Cursor
The reset method returns the cursor to its starting position (defined at construction).
# given: synopsis $cursor->prev; $cursor->next; $cursor->next; $cursor->reset;
Al Newkirk, awncorp@cpan.org
awncorp@cpan.org
Copyright (C) 2011-2019, Al Newkirk, et al.
This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file".
Wiki
Project
Initiatives
Milestones
Contributing
Issues
To install Zing, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Zing
CPAN shell
perl -MCPAN -e shell install Zing
For more information on module installation, please visit the detailed CPAN module installation guide.