import pymysql

from collections import namedtuple


# database config type
DbConf = namedtuple('DbConf', 'type, host, port, username, password, database, prefix, charset')

conf = DbConf('mysql', '127.0.0.1', 3306, 'toor', '123456', 'twong', 'eb_', 'utf8mb4')

conn = pymysql.connect(
    host=conf.host,
    port=conf.port,
    user=conf.username,
    password=conf.password,
    database=conf.database,
    charset=conf.charset,
)

# 表名
def table(name:str) -> str:
    return conf.prefix + name