summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_doc.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/couchdb/couch_doc.erl')
-rw-r--r--src/couchdb/couch_doc.erl32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/couchdb/couch_doc.erl b/src/couchdb/couch_doc.erl
index 1063f501..f8c874b0 100644
--- a/src/couchdb/couch_doc.erl
+++ b/src/couchdb/couch_doc.erl
@@ -195,26 +195,26 @@ transfer_fields([{<<"_rev">>, _Rev} | Rest], Doc) ->
transfer_fields([{<<"_attachments">>, {JsonBins}} | Rest], Doc) ->
Atts = lists:map(fun({Name, {BinProps}}) ->
- case ?getv(<<"stub">>, BinProps) of
+ case couch_util:get_value(<<"stub">>, BinProps) of
true ->
- Type = ?getv(<<"content_type">>, BinProps),
- RevPos = ?getv(<<"revpos">>, BinProps, nil),
- DiskLen = ?getv(<<"length">>, BinProps),
+ Type = couch_util:get_value(<<"content_type">>, BinProps),
+ RevPos = couch_util:get_value(<<"revpos">>, BinProps, nil),
+ DiskLen = couch_util:get_value(<<"length">>, BinProps),
{Enc, EncLen} = att_encoding_info(BinProps),
#att{name=Name, data=stub, type=Type, att_len=EncLen,
disk_len=DiskLen, encoding=Enc, revpos=RevPos};
_ ->
- Type = ?getv(<<"content_type">>, BinProps,
+ Type = couch_util:get_value(<<"content_type">>, BinProps,
?DEFAULT_ATTACHMENT_CONTENT_TYPE),
- RevPos = ?getv(<<"revpos">>, BinProps, 0),
- case ?getv(<<"follows">>, BinProps) of
+ RevPos = couch_util:get_value(<<"revpos">>, BinProps, 0),
+ case couch_util:get_value(<<"follows">>, BinProps) of
true ->
- DiskLen = ?getv(<<"length">>, BinProps),
+ DiskLen = couch_util:get_value(<<"length">>, BinProps),
{Enc, EncLen} = att_encoding_info(BinProps),
#att{name=Name, data=follows, type=Type, encoding=Enc,
att_len=EncLen, disk_len=DiskLen, revpos=RevPos};
_ ->
- Value = ?getv(<<"data">>, BinProps),
+ Value = couch_util:get_value(<<"data">>, BinProps),
Bin = base64:decode(Value),
LenBin = size(Bin),
#att{name=Name, data=Bin, type=Type, att_len=LenBin,
@@ -225,8 +225,8 @@ transfer_fields([{<<"_attachments">>, {JsonBins}} | Rest], Doc) ->
transfer_fields(Rest, Doc#doc{atts=Atts});
transfer_fields([{<<"_revisions">>, {Props}} | Rest], Doc) ->
- RevIds = ?getv(<<"ids">>, Props),
- Start = ?getv(<<"start">>, Props),
+ RevIds = couch_util:get_value(<<"ids">>, Props),
+ Start = couch_util:get_value(<<"start">>, Props),
if not is_integer(Start) ->
throw({doc_validation, "_revisions.start isn't an integer."});
not is_list(RevIds) ->
@@ -261,12 +261,12 @@ transfer_fields([Field | Rest], #doc{body=Fields}=Doc) ->
transfer_fields(Rest, Doc#doc{body=[Field|Fields]}).
att_encoding_info(BinProps) ->
- DiskLen = ?getv(<<"length">>, BinProps),
- case ?getv(<<"encoding">>, BinProps) of
+ DiskLen = couch_util:get_value(<<"length">>, BinProps),
+ case couch_util:get_value(<<"encoding">>, BinProps) of
undefined ->
{identity, DiskLen};
Enc ->
- EncodedLen = ?getv(<<"encoded_length">>, BinProps, DiskLen),
+ EncodedLen = couch_util:get_value(<<"encoded_length">>, BinProps, DiskLen),
{list_to_existing_atom(?b2l(Enc)), EncodedLen}
end.
@@ -338,7 +338,7 @@ att_to_bin(#att{data=DataFun, att_len=Len}) when is_function(DataFun)->
).
get_validate_doc_fun(#doc{body={Props}}=DDoc) ->
- case ?getv(<<"validate_doc_update">>, Props) of
+ case couch_util:get_value(<<"validate_doc_update">>, Props) of
undefined ->
nil;
_Else ->
@@ -473,7 +473,7 @@ doc_from_multi_part_stream(ContentType, DataFun) ->
end.
mp_parse_doc({headers, H}, []) ->
- case ?getv("content-type", H) of
+ case couch_util:get_value("content-type", H) of
{"application/json", _} ->
fun (Next) ->
mp_parse_doc(Next, [])