Couch-DB
view release on metacpan or search on metacpan
lib/Couch/DB/Design.pm view on Meta::CPAN
#-------------
sub create($%)
{ my $self = shift;
defined $self->id
or error __x"Design documents do not generate an id by themselves.";
$self->update(@_);
}
sub update($%)
{ my ($self, $data, $args) = @_;
$self->couch
->toJSON($data, bool => qw/autoupdate/)
->check($data->{lists}, deprecated => '3.0.0', 'DesignDoc create() option list')
->check($data->{lists}, removed => '4.0.0', 'DesignDoc create() option list')
->check($data->{show}, deprecated => '3.0.0', 'DesignDoc create() option show')
->check($data->{show}, removed => '4.0.0', 'DesignDoc create() option show')
->check($data->{rewrites}, deprecated => '3.0.0', 'DesignDoc create() option rewrites');
#XXX Do we need more parameter conversions in the nested queries?
lib/Couch/DB/Document.pm view on Meta::CPAN
sub rev() { ($_[0]->revisions)[0] }
#-------------
sub _info() { $_[0]->{CDD_info} or panic "No info yet" }
sub conflicts() { @{ $_[0]->_info->{_conflicts} || [] } }
sub deletedConflicts() { @{ $_[0]->_info->{_deleted_conflicts} || [] } }
sub updateSequence() { $_[0]->_info->{_local_seq} }
sub revisionsInfo()
{ my $self = shift;
return $self->{CDD_revinfo} if $self->{CDD_revinfo};
my $c = $self->_info->{_revs_info}
or error __x"You have requested the open_revs detail for the document yet.";
$self->{CDD_revinfo} = +{ map +($_->{rev} => $_), @$c };
lib/Couch/DB/Document.pm view on Meta::CPAN
$self->couch->call(POST => $self->db->_pathToDB, # !!
send => $data,
query => \%query,
$self->couch->_resultsConfig(\%args,
on_final => sub { $self->__created($_[0], $data) },
),
);
}
sub update($%)
{ my ($self, $data, %args) = @_;
ref $data eq 'HASH' or panic "Attempt to update the document without data.";
my $couch = $self->couch;
my %query;
$query{batch} = 'ok' if exists $args{batch} ? delete $args{batch} : $self->batch;
$query{rev} = delete $args{rev} || $self->rev;
$query{new_edits} = delete $args{new_edits} if exists $args{new_edits};
$couch->toQuery(\%query, bool => qw/new_edits/);
( run in 0.293 second using v1.01-cache-2.11-cpan-4d4bc49f3ae )