当前位置: 首页>>代码示例>>Python>>正文


Python Connection.append方法代码示例

本文整理汇总了Python中couchbase._libcouchbase.Connection.append方法的典型用法代码示例。如果您正苦于以下问题:Python Connection.append方法的具体用法?Python Connection.append怎么用?Python Connection.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在couchbase._libcouchbase.Connection的用法示例。


在下文中一共展示了Connection.append方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: append

# 需要导入模块: from couchbase._libcouchbase import Connection [as 别名]
# 或者: from couchbase._libcouchbase.Connection import append [as 别名]
    def append(self, key, value, cas=0, ttl=0, format=None):
        """
        Append a string to an existing value in Couchbase.

        This follows the same conventions as
        :meth:`~couchbase.libcouchbase.Connection.set`.

        The `format` argument must be one of :const:`~couchbase.FMT_UTF8` or
        :const:`~couchbase.FMT_BYTES`. If not specified, it will be
        :const:`~couchbase.FMT_UTF8`
        (overriding the :attr:`default_format` attribute).
        This is because JSON or Pickle formats will be nonsensical when
        random data is appended to them. If you wish to modify a JSON or
        Pickle encoded object, you will need to retrieve it (via :meth:`get`),
        modify it, and then store it again (using :meth:`set`).

        Additionally, you must ensure the value (and flags) for the current
        value is compatible with the data to be appended. For an example,
        you may append a :const:`~couchbase.FMT_BYTES` value to an existing
        :const:`~couchbase.FMT_JSON` value, but an error will be thrown when
        retrieving the value using
        :meth:`get` (you may still use the :attr:`data_passthrough` to
        overcome this).

        :raise: :exc:`couchbase.exceptions.NotStoredError` if the key does
          not exist

        .. seealso::

        :meth:`set`
        :meth:`append_multi`

        """
        return _Base.append(self, key, value, ttl=ttl, cas=cas, format=format)
开发者ID:sublee,项目名称:couchbase-python-client,代码行数:36,代码来源:libcouchbase.py


注:本文中的couchbase._libcouchbase.Connection.append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。