NAME
Zing::Table - Entity Lookup Table
ABSTRACT
Entity Lookup Table Construct
SYNOPSIS
use
Zing::Table;
my
$table
= Zing::Table->new(
name
=>
'users'
);
# my $domain = $table->set('unique-id');
DESCRIPTION
This package provides an index and lookup-table for Zing::Repo derived data structures which provides the ability to create a collection of repo objects.
INHERITS
This package inherits behaviors from:
LIBRARIES
This package uses type constraints from:
ATTRIBUTES
This package has the following attributes:
position
position(Maybe[Int])
This attribute is read-write, accepts (Maybe[Int])
values, and is optional.
type
type(TableType)
This attribute is read-only, accepts (TableType)
values, and is optional.
METHODS
This package implements the following methods:
count
count() : Int
The count method returns the number of Zing::Repo objects in the table.
drop
drop() : Int
The drop method returns truthy if the table has been destroyed. This operation does not cascade.
fetch
fetch(Int
$size
= 1) : ArrayRef[Repo]
The fetch method returns the next n
Zing::Repo objects from the table.
- fetch example #2
-
# given: synopsis
$table
->set(
'user-12345'
);
$table
->set(
'user-12346'
);
$table
->set(
'user-12347'
);
$table
->fetch(5);
first
first() : Maybe[Repo]
The first method returns the first Zing::Repo object created in the table.
get
get(Str
$key
) : Maybe[Repo]
The get method returns the Zing::Repo associated with a specific key.
head
head() : Maybe[Repo]
The head method returns the first Zing::Repo object created in the table.
index
index
(Int
$position
) : Maybe[Repo]
The index method returns the Zing::Repo object at the position (index) specified.
last
last
() : Maybe[Repo]
The last method returns the last Zing::Repo object created in the table.
next
next
() : Maybe[Repo]
The next method returns the next Zing::Repo object created in the table.
- next example #3
-
# given: synopsis
$table
->position(
$table
->size);
$table
->prev;
$table
->
next
;
$table
->prev;
prev
prev() : Maybe[Repo]
The prev method returns the previous Zing::Repo object created in the table.
- prev example #3
-
# given: synopsis
$table
->position(
$table
->size);
$table
->
next
;
$table
->
next
;
$table
->prev;
renew
renew() : Int
The renew method returns truthy if it resets the internal cursor, otherwise falsy.
reset
reset
() : Int
The reset method always reset the internal cursor and return truthy.
set
set(Str
$key
) : Repo
The set method creates a Zing::Repo association with a specific key in the table. The key should be unique. Adding the same key will result in duplicate entries.
tail
tail() : Maybe[Repo]
The tail method returns the last Zing::Repo object created in the table.
term
term() : Str
The term method returns the name of the table.
AUTHOR
Al Newkirk, awncorp@cpan.org
LICENSE
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".