我想用Go编写一个小型内存数据库。读取和写入请求将通过channel传递并由数据库引擎处理,这将确保正确完成访问。第一个想法是模仿RWMutex的行为.只是它会使用更惯用的go风格。这是我想做的事情的一个小玩具(虽然相当长)示例。packagemainimport("log""math/rand""time")varsource*rand.RandtypeReqTypeintconst(READ=iotaWRITE)typeDbRequeststruct{Typeint//requesttypeRespCchan*DbResponse//channelforrequestrespons