# Conflicts: # go.mod # go.sum # pkg/common/storage/controller/auth.gopull/2829/head
commit
5041942563
@ -1,62 +0,0 @@
|
|||||||
# Version logging for OpenIM
|
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_TOC -->
|
|
||||||
|
|
||||||
<!-- END MUNGE: GENERATED_TOC -->
|
|
||||||
|
|
||||||
{{ if .Versions -}}
|
|
||||||
<a name="unreleased"></a>
|
|
||||||
## [Unreleased]
|
|
||||||
|
|
||||||
{{ if .Unreleased.CommitGroups -}}
|
|
||||||
{{ range .Unreleased.CommitGroups -}}
|
|
||||||
### {{ .Title }}
|
|
||||||
{{ range .Commits -}}
|
|
||||||
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end -}}
|
|
||||||
{{ end -}}
|
|
||||||
{{ end -}}
|
|
||||||
|
|
||||||
{{ range .Versions }}
|
|
||||||
<a name="{{ .Tag.Name }}"></a>
|
|
||||||
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
|
|
||||||
{{ range .CommitGroups -}}
|
|
||||||
### {{ .Title }}
|
|
||||||
{{ range .Commits -}}
|
|
||||||
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end -}}
|
|
||||||
|
|
||||||
{{- if .RevertCommits -}}
|
|
||||||
### Reverts
|
|
||||||
{{ range .RevertCommits -}}
|
|
||||||
- {{ .Revert.Header }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end -}}
|
|
||||||
|
|
||||||
{{- if .MergeCommits -}}
|
|
||||||
### Pull Requests
|
|
||||||
{{ range .MergeCommits -}}
|
|
||||||
- {{ .Header }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end -}}
|
|
||||||
|
|
||||||
{{- if .NoteGroups -}}
|
|
||||||
{{ range .NoteGroups -}}
|
|
||||||
### {{ .Title }}
|
|
||||||
{{ range .Notes }}
|
|
||||||
{{ .Body }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end -}}
|
|
||||||
{{ end -}}
|
|
||||||
{{ end -}}
|
|
||||||
|
|
||||||
{{- if .Versions }}
|
|
||||||
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
|
|
||||||
{{ range .Versions -}}
|
|
||||||
{{ if .Tag.Previous -}}
|
|
||||||
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
|
|
||||||
{{ end -}}
|
|
||||||
{{ end -}}
|
|
||||||
{{ end -}}
|
|
@ -1,67 +0,0 @@
|
|||||||
bin: git
|
|
||||||
style: github
|
|
||||||
template: CHANGELOG.tpl.md
|
|
||||||
info:
|
|
||||||
title: CHANGELOG
|
|
||||||
repository_url: https://github.com/openimsdk/open-im-server
|
|
||||||
options:
|
|
||||||
tag_filter_pattern: '^v'
|
|
||||||
sort: "date"
|
|
||||||
|
|
||||||
commits:
|
|
||||||
filters:
|
|
||||||
Type:
|
|
||||||
- feat
|
|
||||||
- fix
|
|
||||||
- perf
|
|
||||||
- refactor
|
|
||||||
- docs
|
|
||||||
- test
|
|
||||||
- chore
|
|
||||||
- ci
|
|
||||||
- build
|
|
||||||
sort_by: Scope
|
|
||||||
|
|
||||||
commit_groups:
|
|
||||||
group_by: Type
|
|
||||||
sort_by: Title
|
|
||||||
title_order:
|
|
||||||
- feat
|
|
||||||
- fix
|
|
||||||
- perf
|
|
||||||
- refactor
|
|
||||||
- docs
|
|
||||||
- test
|
|
||||||
- chore
|
|
||||||
- ci
|
|
||||||
- build
|
|
||||||
title_maps:
|
|
||||||
feat: Features
|
|
||||||
|
|
||||||
header:
|
|
||||||
pattern: "<regexp>"
|
|
||||||
pattern_maps:
|
|
||||||
- PropName
|
|
||||||
|
|
||||||
issues:
|
|
||||||
prefix:
|
|
||||||
- #
|
|
||||||
|
|
||||||
refs:
|
|
||||||
actions:
|
|
||||||
- Closes
|
|
||||||
- Fixes
|
|
||||||
|
|
||||||
merges:
|
|
||||||
pattern: "^Merge branch '(\\w+)'$"
|
|
||||||
pattern_maps:
|
|
||||||
- Source
|
|
||||||
|
|
||||||
reverts:
|
|
||||||
pattern: "^Revert \"([\\s\\S]*)\"$"
|
|
||||||
pattern_maps:
|
|
||||||
- Header
|
|
||||||
|
|
||||||
notes:
|
|
||||||
keywords:
|
|
||||||
- BREAKING CHANGE
|
|
@ -0,0 +1,117 @@
|
|||||||
|
package third
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/openimsdk/open-im-server/v3/pkg/authverify"
|
||||||
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
|
||||||
|
"github.com/openimsdk/protocol/third"
|
||||||
|
"github.com/openimsdk/tools/errs"
|
||||||
|
"github.com/openimsdk/tools/utils/datautil"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func IsNotFound(err error) bool {
|
||||||
|
switch errs.Unwrap(err) {
|
||||||
|
case redis.Nil, mongo.ErrNoDocuments:
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *thirdServer) db2pbApplication(val *model.Application) *third.ApplicationVersion {
|
||||||
|
return &third.ApplicationVersion{
|
||||||
|
Id: val.ID.Hex(),
|
||||||
|
Platform: val.Platform,
|
||||||
|
Version: val.Version,
|
||||||
|
Url: val.Url,
|
||||||
|
Text: val.Text,
|
||||||
|
Force: val.Force,
|
||||||
|
Latest: val.Latest,
|
||||||
|
CreateTime: val.CreateTime.UnixMilli(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *thirdServer) LatestApplicationVersion(ctx context.Context, req *third.LatestApplicationVersionReq) (*third.LatestApplicationVersionResp, error) {
|
||||||
|
res, err := t.applicationDatabase.LatestVersion(ctx, req.Platform)
|
||||||
|
if err == nil {
|
||||||
|
return &third.LatestApplicationVersionResp{Version: t.db2pbApplication(res)}, nil
|
||||||
|
} else if IsNotFound(err) {
|
||||||
|
return &third.LatestApplicationVersionResp{}, nil
|
||||||
|
} else {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *thirdServer) AddApplicationVersion(ctx context.Context, req *third.AddApplicationVersionReq) (*third.AddApplicationVersionResp, error) {
|
||||||
|
if err := authverify.CheckAdmin(ctx, t.config.Share.IMAdminUserID); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
val := &model.Application{
|
||||||
|
ID: primitive.NewObjectID(),
|
||||||
|
Platform: req.Platform,
|
||||||
|
Version: req.Version,
|
||||||
|
Url: req.Url,
|
||||||
|
Text: req.Text,
|
||||||
|
Force: req.Force,
|
||||||
|
Latest: req.Latest,
|
||||||
|
CreateTime: time.Now(),
|
||||||
|
}
|
||||||
|
if err := t.applicationDatabase.AddVersion(ctx, val); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &third.AddApplicationVersionResp{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *thirdServer) UpdateApplicationVersion(ctx context.Context, req *third.UpdateApplicationVersionReq) (*third.UpdateApplicationVersionResp, error) {
|
||||||
|
if err := authverify.CheckAdmin(ctx, t.config.Share.IMAdminUserID); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
oid, err := primitive.ObjectIDFromHex(req.Id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errs.ErrArgs.WrapMsg("invalid id " + err.Error())
|
||||||
|
}
|
||||||
|
update := make(map[string]any)
|
||||||
|
putUpdate(update, "platform", req.Platform)
|
||||||
|
putUpdate(update, "version", req.Version)
|
||||||
|
putUpdate(update, "url", req.Url)
|
||||||
|
putUpdate(update, "text", req.Text)
|
||||||
|
putUpdate(update, "force", req.Force)
|
||||||
|
putUpdate(update, "latest", req.Latest)
|
||||||
|
if err := t.applicationDatabase.UpdateVersion(ctx, oid, update); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &third.UpdateApplicationVersionResp{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *thirdServer) DeleteApplicationVersion(ctx context.Context, req *third.DeleteApplicationVersionReq) (*third.DeleteApplicationVersionResp, error) {
|
||||||
|
if err := authverify.CheckAdmin(ctx, t.config.Share.IMAdminUserID); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
ids := make([]primitive.ObjectID, 0, len(req.Id))
|
||||||
|
for _, id := range req.Id {
|
||||||
|
oid, err := primitive.ObjectIDFromHex(id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errs.ErrArgs.WrapMsg("invalid id " + err.Error())
|
||||||
|
}
|
||||||
|
ids = append(ids, oid)
|
||||||
|
}
|
||||||
|
if err := t.applicationDatabase.DeleteVersion(ctx, ids); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &third.DeleteApplicationVersionResp{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *thirdServer) PageApplicationVersion(ctx context.Context, req *third.PageApplicationVersionReq) (*third.PageApplicationVersionResp, error) {
|
||||||
|
total, res, err := t.applicationDatabase.PageVersion(ctx, req.Platform, req.Pagination)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &third.PageApplicationVersionResp{
|
||||||
|
Total: total,
|
||||||
|
Versions: datautil.Slice(res, t.db2pbApplication),
|
||||||
|
}, nil
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package cache
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ApplicationCache interface {
|
||||||
|
LatestVersion(ctx context.Context, platform string) (*model.Application, error)
|
||||||
|
DeleteCache(ctx context.Context, platforms []string) error
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package cachekey
|
||||||
|
|
||||||
|
const (
|
||||||
|
ApplicationLatestVersion = "APPLICATION_LATEST_VERSION:"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetApplicationLatestVersionKey(platform string) string {
|
||||||
|
return ApplicationLatestVersion + platform
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package redis
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/dtm-labs/rockscache"
|
||||||
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey"
|
||||||
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/database"
|
||||||
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
|
||||||
|
"github.com/openimsdk/tools/utils/datautil"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewApplicationRedisCache(db database.Application, rdb redis.UniversalClient) *ApplicationRedisCache {
|
||||||
|
return &ApplicationRedisCache{
|
||||||
|
db: db,
|
||||||
|
rcClient: rockscache.NewClient(rdb, *GetRocksCacheOptions()),
|
||||||
|
deleter: NewBatchDeleterRedis(rdb, GetRocksCacheOptions(), nil),
|
||||||
|
expireTime: time.Hour * 24 * 7,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type ApplicationRedisCache struct {
|
||||||
|
db database.Application
|
||||||
|
rcClient *rockscache.Client
|
||||||
|
deleter *BatchDeleterRedis
|
||||||
|
expireTime time.Duration
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *ApplicationRedisCache) LatestVersion(ctx context.Context, platform string) (*model.Application, error) {
|
||||||
|
return getCache(ctx, a.rcClient, cachekey.GetApplicationLatestVersionKey(platform), a.expireTime, func(ctx context.Context) (*model.Application, error) {
|
||||||
|
return a.db.LatestVersion(ctx, platform)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *ApplicationRedisCache) DeleteCache(ctx context.Context, platforms []string) error {
|
||||||
|
if len(platforms) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return a.deleter.ExecDelWithKeys(ctx, datautil.Slice(platforms, func(platform string) string {
|
||||||
|
return cachekey.GetApplicationLatestVersionKey(platform)
|
||||||
|
}))
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package controller
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache"
|
||||||
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/database"
|
||||||
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
|
||||||
|
"github.com/openimsdk/tools/db/pagination"
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ApplicationDatabase interface {
|
||||||
|
LatestVersion(ctx context.Context, platform string) (*model.Application, error)
|
||||||
|
AddVersion(ctx context.Context, val *model.Application) error
|
||||||
|
UpdateVersion(ctx context.Context, id primitive.ObjectID, update map[string]any) error
|
||||||
|
DeleteVersion(ctx context.Context, id []primitive.ObjectID) error
|
||||||
|
PageVersion(ctx context.Context, platforms []string, page pagination.Pagination) (int64, []*model.Application, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewApplicationDatabase(db database.Application, cache cache.ApplicationCache) ApplicationDatabase {
|
||||||
|
return &applicationDatabase{db: db, cache: cache}
|
||||||
|
}
|
||||||
|
|
||||||
|
type applicationDatabase struct {
|
||||||
|
db database.Application
|
||||||
|
cache cache.ApplicationCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *applicationDatabase) LatestVersion(ctx context.Context, platform string) (*model.Application, error) {
|
||||||
|
return a.cache.LatestVersion(ctx, platform)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *applicationDatabase) AddVersion(ctx context.Context, val *model.Application) error {
|
||||||
|
if err := a.db.AddVersion(ctx, val); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return a.cache.DeleteCache(ctx, []string{val.Platform})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *applicationDatabase) UpdateVersion(ctx context.Context, id primitive.ObjectID, update map[string]any) error {
|
||||||
|
platforms, err := a.db.FindPlatform(ctx, []primitive.ObjectID{id})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := a.db.UpdateVersion(ctx, id, update); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if p, ok := update["platform"]; ok {
|
||||||
|
if val, ok := p.(string); ok {
|
||||||
|
platforms = append(platforms, val)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return a.cache.DeleteCache(ctx, platforms)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *applicationDatabase) DeleteVersion(ctx context.Context, id []primitive.ObjectID) error {
|
||||||
|
platforms, err := a.db.FindPlatform(ctx, id)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := a.db.DeleteVersion(ctx, id); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return a.cache.DeleteCache(ctx, platforms)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *applicationDatabase) PageVersion(ctx context.Context, platforms []string, page pagination.Pagination) (int64, []*model.Application, error) {
|
||||||
|
return a.db.PageVersion(ctx, platforms, page)
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package database
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
|
||||||
|
"github.com/openimsdk/tools/db/pagination"
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Application interface {
|
||||||
|
LatestVersion(ctx context.Context, platform string) (*model.Application, error)
|
||||||
|
AddVersion(ctx context.Context, val *model.Application) error
|
||||||
|
UpdateVersion(ctx context.Context, id primitive.ObjectID, update map[string]any) error
|
||||||
|
DeleteVersion(ctx context.Context, id []primitive.ObjectID) error
|
||||||
|
PageVersion(ctx context.Context, platforms []string, page pagination.Pagination) (int64, []*model.Application, error)
|
||||||
|
FindPlatform(ctx context.Context, id []primitive.ObjectID) ([]string, error)
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
package mgo
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
|
||||||
|
"github.com/openimsdk/tools/db/mongoutil"
|
||||||
|
"github.com/openimsdk/tools/db/pagination"
|
||||||
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo/options"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewApplicationMgo(db *mongo.Database) (*ApplicationMgo, error) {
|
||||||
|
coll := db.Collection("application")
|
||||||
|
_, err := coll.Indexes().CreateMany(context.Background(), []mongo.IndexModel{
|
||||||
|
{
|
||||||
|
Keys: bson.D{
|
||||||
|
{Key: "platform", Value: 1},
|
||||||
|
{Key: "version", Value: 1},
|
||||||
|
},
|
||||||
|
Options: options.Index().SetUnique(true),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Keys: bson.D{
|
||||||
|
{Key: "latest", Value: -1},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &ApplicationMgo{coll: coll}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type ApplicationMgo struct {
|
||||||
|
coll *mongo.Collection
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *ApplicationMgo) sort() any {
|
||||||
|
return bson.D{{"latest", -1}, {"_id", -1}}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *ApplicationMgo) LatestVersion(ctx context.Context, platform string) (*model.Application, error) {
|
||||||
|
return mongoutil.FindOne[*model.Application](ctx, a.coll, bson.M{"platform": platform}, options.FindOne().SetSort(a.sort()))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *ApplicationMgo) AddVersion(ctx context.Context, val *model.Application) error {
|
||||||
|
if val.ID.IsZero() {
|
||||||
|
val.ID = primitive.NewObjectID()
|
||||||
|
}
|
||||||
|
return mongoutil.InsertMany(ctx, a.coll, []*model.Application{val})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *ApplicationMgo) UpdateVersion(ctx context.Context, id primitive.ObjectID, update map[string]any) error {
|
||||||
|
if len(update) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return mongoutil.UpdateOne(ctx, a.coll, bson.M{"_id": id}, bson.M{"$set": update}, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *ApplicationMgo) DeleteVersion(ctx context.Context, id []primitive.ObjectID) error {
|
||||||
|
if len(id) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return mongoutil.DeleteMany(ctx, a.coll, bson.M{"_id": bson.M{"$in": id}})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *ApplicationMgo) PageVersion(ctx context.Context, platforms []string, page pagination.Pagination) (int64, []*model.Application, error) {
|
||||||
|
filter := bson.M{}
|
||||||
|
if len(platforms) > 0 {
|
||||||
|
filter["platform"] = bson.M{"$in": platforms}
|
||||||
|
}
|
||||||
|
return mongoutil.FindPage[*model.Application](ctx, a.coll, filter, page, options.Find().SetSort(a.sort()))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *ApplicationMgo) FindPlatform(ctx context.Context, id []primitive.ObjectID) ([]string, error) {
|
||||||
|
if len(id) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return mongoutil.Find[string](ctx, a.coll, bson.M{"_id": bson.M{"$in": id}}, options.Find().SetProjection(bson.M{"_id": 0, "platform": 1}))
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Application struct {
|
||||||
|
ID primitive.ObjectID `bson:"_id"`
|
||||||
|
Platform string `bson:"platform"`
|
||||||
|
Version string `bson:"version"`
|
||||||
|
Url string `bson:"url"`
|
||||||
|
Text string `bson:"text"`
|
||||||
|
Force bool `bson:"force"`
|
||||||
|
Latest bool `bson:"latest"`
|
||||||
|
CreateTime time.Time `bson:"create_time"`
|
||||||
|
}
|
Loading…
Reference in new issue