mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
pb path
This commit is contained in:
parent
232a1be53e
commit
aca2843224
72
go.mod
72
go.mod
@ -47,6 +47,78 @@ require (
|
||||
github.com/minio/minio-go v6.0.14+incompatible
|
||||
)
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.105.0 // indirect
|
||||
cloud.google.com/go/compute v1.13.0 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.2.1 // indirect
|
||||
cloud.google.com/go/firestore v1.9.0 // indirect
|
||||
cloud.google.com/go/iam v0.8.0 // indirect
|
||||
cloud.google.com/go/longrunning v0.3.0 // indirect
|
||||
cloud.google.com/go/storage v1.27.0 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/dustin/go-humanize v1.0.0 // indirect
|
||||
github.com/eapache/go-resiliency v1.2.0 // indirect
|
||||
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
|
||||
github.com/eapache/queue v1.1.0 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.0 // indirect
|
||||
github.com/go-sql-driver/mysql v1.6.0 // indirect
|
||||
github.com/go-stack/stack v1.8.0 // indirect
|
||||
github.com/go-zookeeper/zk v1.0.3 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
|
||||
github.com/golang/snappy v0.0.3 // indirect
|
||||
github.com/google/go-cmp v0.5.9 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
|
||||
github.com/hashicorp/go-uuid v1.0.2 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.1 // indirect
|
||||
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
|
||||
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
|
||||
github.com/jcmturner/gofork v1.0.0 // indirect
|
||||
github.com/jcmturner/gokrb5/v8 v8.4.2 // indirect
|
||||
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/compress v1.13.6 // indirect
|
||||
github.com/klauspost/cpuid v1.3.1 // indirect
|
||||
github.com/leodido/go-urn v1.2.1 // indirect
|
||||
github.com/lithammer/shortuuid v3.0.0+incompatible // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
||||
github.com/minio/md5-simd v1.1.0 // indirect
|
||||
github.com/minio/sha256-simd v0.1.1 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
|
||||
github.com/pierrec/lz4 v2.6.0+incompatible // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.37.0 // indirect
|
||||
github.com/prometheus/procfs v0.8.0 // indirect
|
||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
|
||||
github.com/rs/xid v1.2.1 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
||||
github.com/xdg-go/scram v1.0.2 // indirect
|
||||
github.com/xdg-go/stringprep v1.0.2 // indirect
|
||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sys v0.4.0 // indirect
|
||||
golang.org/x/text v0.6.0 // indirect
|
||||
golang.org/x/time v0.1.0 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/go-ini/ini v1.67.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
|
@ -9,9 +9,9 @@ import (
|
||||
"OpenIM/pkg/common/http"
|
||||
"OpenIM/pkg/common/tracelog"
|
||||
"OpenIM/pkg/proto/group"
|
||||
"OpenIM/pkg/proto/wrapperspb"
|
||||
"OpenIM/pkg/utils"
|
||||
"context"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
107
pkg/common/db/cache/redis_test.go
vendored
107
pkg/common/db/cache/redis_test.go
vendored
@ -1,107 +0,0 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"OpenIM/pkg/common/constant"
|
||||
pbChat "OpenIM/pkg/proto/msg"
|
||||
common "OpenIM/pkg/proto/sdkws"
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var DB RedisClient
|
||||
|
||||
func Test_SetTokenMapByUidPid(t *testing.T) {
|
||||
m := make(map[string]int, 0)
|
||||
m["test1"] = 1
|
||||
m["test2"] = 2
|
||||
m["2332"] = 4
|
||||
err := DB.SetTokenMapByUidPid("1234", 2, m)
|
||||
assert.Nil(t, err)
|
||||
|
||||
}
|
||||
func Test_GetTokenMapByUidPid(t *testing.T) {
|
||||
m, err := DB.GetTokenMapByUidPid("1234", "Android")
|
||||
assert.Nil(t, err)
|
||||
fmt.Println(m)
|
||||
}
|
||||
|
||||
//func TestDataBases_GetMultiConversationMsgOpt(t *testing.T) {
|
||||
// m, err := DB.GetMultiConversationMsgOpt("fg", []string{"user", "age", "color"})
|
||||
// assert.Nil(t, err)
|
||||
// fmt.Println(m)
|
||||
//}
|
||||
func Test_GetKeyTTL(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
key := flag.String("key", "key", "key value")
|
||||
flag.Parse()
|
||||
ttl, err := DB.GetClient().TTL(ctx, *key).Result()
|
||||
assert.Nil(t, err)
|
||||
fmt.Println(ttl)
|
||||
}
|
||||
func Test_HGetAll(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
key := flag.String("key", "key", "key value")
|
||||
flag.Parse()
|
||||
ttl, err := DB.GetClient().TTL(ctx, *key).Result()
|
||||
assert.Nil(t, err)
|
||||
fmt.Println(ttl)
|
||||
}
|
||||
|
||||
func Test_NewSetMessageToCache(t *testing.T) {
|
||||
var msg pbChat.MsgDataToMQ
|
||||
m := make(map[string]bool)
|
||||
var offlinePush common.OfflinePushInfo
|
||||
offlinePush.Title = "3"
|
||||
offlinePush.Ex = "34"
|
||||
offlinePush.IOSPushSound = "+1"
|
||||
offlinePush.IOSBadgeCount = true
|
||||
m[constant.IsPersistent] = true
|
||||
m[constant.IsHistory] = true
|
||||
var data common.MsgData
|
||||
uid := "test_uid"
|
||||
data.Seq = 11
|
||||
data.ClientMsgID = "23jwhjsdf"
|
||||
data.SendID = "111"
|
||||
data.RecvID = "222"
|
||||
data.Content = []byte{1, 2, 3, 4, 5, 6, 7}
|
||||
data.Seq = 1212
|
||||
data.Options = m
|
||||
data.OfflinePushInfo = &offlinePush
|
||||
data.AtUserIDList = []string{"1212", "23232"}
|
||||
msg.MsgData = &data
|
||||
messageList := []*pbChat.MsgDataToMQ{&msg}
|
||||
err, _ := DB.SetMessageToCache(messageList, uid, "cacheTest")
|
||||
assert.Nil(t, err)
|
||||
|
||||
}
|
||||
func Test_NewGetMessagesBySeq(t *testing.T) {
|
||||
var msg pbChat.MsgDataToMQ
|
||||
var data common.MsgData
|
||||
uid := "test_uid"
|
||||
data.Seq = 11
|
||||
data.ClientMsgID = "23jwhjsdf"
|
||||
msg.MsgData = &data
|
||||
|
||||
seqMsg, failedSeqList, err := DB.GetMessagesBySeq(uid, []uint32{1212}, "cacheTest")
|
||||
assert.Nil(t, err)
|
||||
fmt.Println(seqMsg, failedSeqList)
|
||||
|
||||
}
|
||||
|
||||
func Test_SetFcmToken(t *testing.T) {
|
||||
uid := "test_uid"
|
||||
token := "dfnWBtOjSj-XIZnUvDlegv:APA91bG09XTtiXfpE6U7gUVMOhnKcUkNCv4WHn0UZr2clUi-tS1jEH-HiCEW8GIAhjLIGcfUJ6NIKteC023ZxDH7J0PJ5sTxoup3fHDUPLU7KgQoZS4tPyFqCbZ6bRB7esDPEnD1n_s0"
|
||||
platformID := 2
|
||||
err := DB.SetFcmToken(uid, platformID, token, 0)
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
func Test_GetFcmToken(t *testing.T) {
|
||||
uid := "test_uid"
|
||||
platformID := 2
|
||||
token, err := DB.GetFcmToken(uid, platformID)
|
||||
assert.Nil(t, err)
|
||||
fmt.Println("token is :", token)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user