The present invention relates to compounds and methods for treating viral infections (e.g., Hepatitis B viral infections). The compounds of the disclosure are described by formula I: or a pharmaceutically acceptable salt, stereoisomer, a diastereomer, an enantiomer or racemate thereof.本發明關於用於治療病毒感染(例如,B型肝炎病毒感染)之化合物及方法。本發明之該化合物如式I所示:或其藥學上可接受之鹽、立體異構物、非鏡像異構物,鏡像異構物或外消旋物。