我正在学习如何使用灯泡模型,我有关于节点类初始化的问题。你知道吗
根据文件:
from bulbs.model import Node, Relationship
from bulbs.property import String, Integer, DateTime
from bulbs.utils import current_datetime
class Person(Node):
element_type = "person"
name = String(nullable=False)
age = Integer()
在将数据保存到节点之前,如何执行数据操作?你知道吗
我能表演一下吗
class Person(Node):
element_type = "person"
name = String(nullable=False)
if name == "Bar":
name = "Foo"
或者我必须重写节点初始化?你知道吗
class Person(Node):
element_type = "person"
name = String(nullable=False)
def __init__(self, name):
if name == "Bar":
self.name = "Foo"
重写模型的
_create()
方法。你知道吗见https://github.com/espeed/bulbs/blob/master/bulbs/model.py#L565
另请参见“定制灯泡型号示例”:
Is there a equivalent to commit in bulbs framework for neo4j
相关问题 更多 >
编程相关推荐