layout
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
September 23, 2024
: Revert "chore: add 9.21 beijing meetup to zh homepage" (#1152) (5e9509f)