Example #1
0
def generate_entity_h(structs: List[Struct]):
    entity_h = Header()
    entity_h.set_header_guard("__{name}_{proj}_DB_ENTITY_H".format(
        name=os.getlogin().upper(), proj=proj_name.upper()))
    entity_h.add_pragma("once")
    entity_h.add_global_include("string.h")
    entity_h.add_global_include("stdlib.h")
    entity_h.add_global_include("mysql/mysql.h")

    entity_h.add_local_include("db/dbc.h")

    for struct in structs:
        entity_h.add_local_include(f"db/orm/{struct.name}.h")

    return str(entity_h)