示例#1
0
    def insert_root_node(self, properties=None):
        """
        Create root node, then get it.

        :param dict properties: Inheritable key/value pairs
                                (see :ref:`core-properties`)
        """
        node_id = core.insert_node(self.cursor, properties).id
        return self.node_factory(self, node_id)
    def insert_root_node(self, properties=None):
        """
        Create root node, then get it.

        :param dict properties: Inheritable key/value pairs
                                (see :ref:`core-properties`)
        """
        node_id = core.insert_node(self.cursor, None, properties).id
        return self.node_factory(self, node_id)
示例#3
0
文件: node.py 项目: jameshy/libtree
    def insert_child(self, properties=None, position=-1):
        """
        Create a child node and return it.

        :param dict properties: Inheritable key/value pairs
                                (see :ref:`coreapi-properties`)
        :param int position: Position in between siblings. If 0, the
                             node will be inserted at the beginning of
                             the parents children. If -1, the node will
                             be inserted the the end of the parents
                             children.
        """
        node_data = core.insert_node(self._cursor, self.id, properties,
                                     position=position, auto_position=True)
        return Node(self.transaction, node_data.id)
示例#4
0
    def insert_child(self, properties=None, position=-1):
        """
        Create a child node and return it.

        :param dict properties: Inheritable key/value pairs
                                (see :ref:`core-properties`)
        :param int position: Position in between siblings. If 0, the
                             node will be inserted at the beginning of
                             the parents children. If -1, the node will
                             be inserted the the end of the parents
                             children.
        """
        node_data = core.insert_node(self._cursor, self.id, properties,
                                     position=position, auto_position=True)
        return Node(self._transaction, node_data.id)
示例#5
0
    def insert_child(self, properties=None, position=-1, id=None):
        """
        Create a child node and return it.

        :param dict properties: Inheritable key/value pairs
                                (see :ref:`core-properties`)
        :param int position: Position in between siblings. If 0, the
                             node will be inserted at the beginning of
                             the parents children. If -1, the node will
                             be inserted the the end of the parents
                             children.
        :param uuid4 id: Use this ID instead of automatically generating
                         one.
        """
        node_data = core.insert_node(self._cursor, self.id, properties,
                                     position=position, auto_position=True,
                                     id=id)
        return Node(self._transaction, node_data.id)