package mongo import ( "context" "github.com/zeromicro/go-zero/core/stores/mon" "go.mongodb.org/mongo-driver/mongo" mopt "go.mongodb.org/mongo-driver/mongo/options" ) type DocumentDBUseCase interface { PopulateIndex(ctx context.Context, key string, sort int32, unique bool) PopulateTTLIndex(ctx context.Context, key string, sort int32, unique bool, ttl int32) PopulateMultiIndex(ctx context.Context, keys []string, sorts []int32, unique bool) GetClient() *mon.Model } type DocumentDBWithCacheUseCase interface { DocumentDBUseCase CacheUseCase DeleteOne(ctx context.Context, key string, filter any, opts ...*mopt.DeleteOptions) (int64, error) FindOne(ctx context.Context, key string, v, filter any, opts ...*mopt.FindOneOptions) error FindOneAndDelete(ctx context.Context, key string, v, filter any, opts ...*mopt.FindOneAndDeleteOptions) error FindOneAndReplace(ctx context.Context, key string, v, filter, replacement any, opts ...*mopt.FindOneAndReplaceOptions) error InsertOne(ctx context.Context, key string, document any, opts ...*mopt.InsertOneOptions) (*mongo.InsertOneResult, error) UpdateByID(ctx context.Context, key string, id, update any, opts ...*mopt.UpdateOptions) (*mongo.UpdateResult, error) UpdateMany(ctx context.Context, keys []string, filter, update any, opts ...*mopt.UpdateOptions) (*mongo.UpdateResult, error) UpdateOne(ctx context.Context, key string, filter, update any, opts ...*mopt.UpdateOptions) (*mongo.UpdateResult, error) } type CacheUseCase interface { DelCache(ctx context.Context, keys ...string) error GetCache(key string, v any) error SetCache(key string, v any) error }