# -*- coding: utf-8 -*-
# @Time : 2023/8/1 11:47
# @Author : Ultipa
# @Email : [email protected]
# @File : Schema.py
from typing import List
from ultipa.structs import DBType
from ultipa.structs.Property import Property
from ultipa.structs.BaseModel import BaseModel
[docs]
class Schema(BaseModel):
'''
Data class for schema.
'''
def __init__(self, name: str, dbType: DBType, type: str = None, description: str = None,
properties: List[Property] = None,
total: int = None):
self.description = description
self.properties = properties
self.name = name
self.total = total
self.type = type
self.DBType = dbType
[docs]
def getProperty(self, name: str):
find = list(filter(lambda x: x.get('name') == name, self.properties))
if find:
return find[0]
return None