本文整理匯總了Python中peewee.TextField方法的典型用法代碼示例。如果您正苦於以下問題:Python peewee.TextField方法的具體用法?Python peewee.TextField怎麽用?Python peewee.TextField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類peewee
的用法示例。
在下文中一共展示了peewee.TextField方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _create_model
# 需要導入模塊: import peewee [as 別名]
# 或者: from peewee import TextField [as 別名]
def _create_model(self, db, table_prefix):
"""
創建數據model
"""
meta_dict = {
"database": db,
"table_name": table_prefix + "_" + "Report"
}
meta = type("Meta", (object, ), meta_dict)
model_dict = {
"id": peewee.AutoField(),
"plugin_name": peewee.CharField(max_length=63),
"description": peewee.TextField(),
"rasp_result_list": self.LongTextField(),
"payload_seq": peewee.CharField(unique=True, max_length=63),
"message": peewee.TextField(),
"time": peewee.IntegerField(default=common.get_timestamp),
"upload": peewee.IntegerField(default=0),
"Meta": meta
}
self.Report = type("Report", (peewee.Model, ), model_dict)
return self.Report
示例2: _create_model
# 需要導入模塊: import peewee [as 別名]
# 或者: from peewee import TextField [as 別名]
def _create_model(self, db, table_prefix):
"""
創建數據model
"""
meta_dict = {
"database": db,
"table_name": "Config"
}
meta = type("Meta", (object, ), meta_dict)
model_dict = {
"host_port_hash": peewee.CharField(primary_key=True, max_length=63),
"host_port": peewee.TextField(),
"config_json": peewee.TextField(),
"Meta": meta
}
self.Config = type("Config", (peewee.Model, ), model_dict)
return self.Config
示例3: __init__
# 需要導入模塊: import peewee [as 別名]
# 或者: from peewee import TextField [as 別名]
def __init__(self, data_model):
self.data_model = data_model
self.data_model.fake_item_ids_store = self
assert self.data_model.cache_dir, "FakeItemIds need cache_dir from data_model!"
sqlite_path = os.path.join(self.data_model.cache_dir, "fake_item_ids_store.db")
sqlite_database = SqliteDatabase(sqlite_path, check_same_thread=False)
class FakeItemIdsStore(Model):
is_deleted = BooleanField(default=False) # mark processed or duplicated items
item_id = CharField()
item_content_json = TextField()
created_at = TimeField(default=datetime.datetime.now)
class Meta:
database = sqlite_database
self.storage = FakeItemIdsStore
if not self.storage.table_exists():
self.storage.create_table()
sqlite_database.create_index(self.storage, "is_deleted item_id".split(" "))
示例4: migrate
# 需要導入模塊: import peewee [as 別名]
# 或者: from peewee import TextField [as 別名]
def migrate(migrator):
return [migrator.add_column("event", "country", peewee.TextField(default="US"))]
示例5: migrate
# 需要導入模塊: import peewee [as 別名]
# 或者: from peewee import TextField [as 別名]
def migrate(migrator):
return [
migrator.add_column(
"event", "voice_greeting", peewee.TextField(null=True, index=False)
),
migrator.add_column(
"event", "sms_greeting", peewee.TextField(null=True, index=False)
),
]
示例6: migrate
# 需要導入模塊: import peewee [as 別名]
# 或者: from peewee import TextField [as 別名]
def migrate(migrator):
return [
migrator.add_column(
"number", "features", peewee.TextField(default="SMS,VOICE", index=False)
)
]
示例7: migrate
# 需要導入模塊: import peewee [as 別名]
# 或者: from peewee import TextField [as 別名]
def migrate(migrator):
return [
migrator.add_column(
"auditlog", "reporter_number", peewee.TextField(null=True, index=False)
),
CreateModels(),
]
示例8: test_change_column_type_char_text
# 需要導入模塊: import peewee [as 別名]
# 或者: from peewee import TextField [as 別名]
def test_change_column_type_char_text(self):
class SomeModel(pw.Model):
some_field = pw.CharField(default='woot')
class Meta:
database = self.db
self.evolve_and_check_noop()
model = SomeModel.create()
self.assertEqual(model.some_field, 'woot')
peeweedbevolve.clear()
class SomeModel(pw.Model):
some_field = pw.TextField(default='woot')
class Meta:
database = self.db
self.evolve_and_check_noop()
self.assertEqual(SomeModel.select().first().some_field, 'woot')