Couch-DB

 view release on metacpan or  search on metacpan

lib/Couch/DB/Design.pm  view on Meta::CPAN

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
sub idBase() { $_[0]->{CDD_base} }
 
#-------------
 
sub create($%)
{       my $self = shift;
        $self->update(@_);
}
 
 
sub update($%)
{       my ($self, $data, %args) = @_;
        $data->{_id} = $self->id;
 
        $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');

lib/Couch/DB/Document.pm  view on Meta::CPAN

141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
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

201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
        $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.237 second using v1.01-cache-2.11-cpan-05444aca049 )