import random import time def get_uid(): return hex(int(time.time() * 10 ** 7) + random.randint(0, 10000))[2:] # 获取筛选条件的包含关系 def get_bijiao(bijiao): if bijiao == '==' or bijiao == 'in' or bijiao == 'like' or bijiao == 'is not null': return "IN" elif bijiao == '!=' or bijiao == 'not like' or bijiao == 'is null': return 'NOT LIKE' # 判断传入的数据类型 def estimate_data(data_type): if data_type == 'int': return "Nullable(Int64)" elif data_type == 'ip': return "Nullable(DateTime('UTC'))" else: return "Nullable(String)" #将字典变成字符串 def dict_to_str(dic): c = str() b = 0 for k, v in dic.items(): b += 1 if b == 1: c += "{\"%s\":\"%s\"," % (k, v) elif b != len(dic): c += "\"%s\":\"%s\"," % (k, v) else: c += "\"%s\":\"%s\"}" % (k, v) return c