layout

image

biz/doc/dao/{struct name}:Store the mongodb curd code, and the generated location can be modified through –dao dir

  • {struct name}_repo.go Function interface file
  • {struct name}_repo_mongo.go Interface implementation and specific curd code

biz/doc/model:The code generated by thriftgo or protoc, where the go struct corresponding to the Mongodb set is located, can be modified by using –model_dir

The user needs to pass in the set *mongo.Collection parameter and call the New{struct name}Repository function in {struct name}_repo_mongo.go to use the tool generated CURD function.

Example Code:

// call NewUserRepository
userMongo := user.NewUserRepository(collection)
// call InsertUser to insert user document to mongodb
user.InsertUser(ctx, user)...

Last modified July 24, 2024 : docs: fix error in render (#1110) (34e4f87)