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 14, 2024
: doc: add kitex v0.11.0 release log (#1135) (796ca7c)