NAME

Zing::Lookup - Domain Lookup Table

ABSTRACT

Domain Lookup Table Construct

SYNOPSIS

use Zing::Lookup;

my $lookup = Zing::Lookup->new(name => 'users');

# my $domain = $lookup->set('unique-id');

DESCRIPTION

This package provides an index and lookup-table for Zing::Domain data structures which provides the ability to create a collection of domains with full history of state changes.

INHERITS

This package inherits behaviors from:

Zing::Domain

LIBRARIES

This package uses type constraints from:

Zing::Types

METHODS

This package implements the following methods:

cursor

cursor() : Cursor

The cursor method returns a Zing::Cursor object which provides the ability to page-through and traverse the lookup dataset forwards and backwards.

cursor example #1
# given: synopsis

$lookup->cursor;

del

del(Str $key) : Lookup

The del method deletes the Zing::Domain associated with a specific key.

del example #1
# given: synopsis

$lookup->del('user-12345');
del example #2
# given: synopsis

$lookup->set('user-12345', 'me@example.com');

$lookup->del('user-12345');

drop

drop() : Int

The drop method deletes all data associated with the lookup.

drop example #1
# given: synopsis

$lookup->set('user-12345', 'me@example.com');

$lookup->drop;
drop example #2
# given: synopsis

$lookup->set('user-12345', 'me@example.com');

$lookup->savepoint->send;

$lookup->drop;

get

get(Str $key) : Maybe[Domain]

The get method return the Zing::Domain associated with a specific key.

get example #1
# given: synopsis

$lookup->get('user-12345');
get example #2
# given: synopsis

$lookup->set('user-12345')->set(email => 'me@example.com');

$lookup->get('user-12345');

savepoint

savepoint() : Savepoint

The savepoint method returns a Zing::Savepoint object which provides the ability to save and restore large indices (lookup states). If a lookup has an associated savepoint it will be loaded automatically on object construction.

savepoint example #1
# given: synopsis

$lookup->savepoint;

set

set(Str $key) : Domain

The set method creates a Zing::Domain association with a specific key in the lookup. The key must be unique or will overwrite any existing data.

set example #1
# given: synopsis

$lookup->del('user-12345');

$lookup->set('user-12345');

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".

PROJECT

Wiki

Project

Initiatives

Milestones

Contributing

Issues