golang-im聊天
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

message_repo_test.go 780 B

2 years ago
123456789101112131415161718192021222324252627282930313233343536373839
  1. package repo
  2. import (
  3. "fmt"
  4. "gim/internal/logic/domain/message/model"
  5. "testing"
  6. "time"
  7. )
  8. func TestMessageDao_Add(t *testing.T) {
  9. message := model.Message{
  10. UserId: 1,
  11. RequestId: 1,
  12. SenderType: 1,
  13. SenderId: 1,
  14. ReceiverType: 1,
  15. ReceiverId: 1,
  16. ToUserIds: "1",
  17. Type: 1,
  18. Content: []byte("123456"),
  19. Seq: 2,
  20. SendTime: time.Now(),
  21. Status: 0,
  22. }
  23. fmt.Println(MessageRepo.Save(message))
  24. }
  25. func TestMessageDao_ListByUserIdAndUserSeq(t *testing.T) {
  26. messages, hasMore, err := MessageRepo.ListBySeq(1, 0, 100)
  27. fmt.Println(err)
  28. fmt.Println(hasMore)
  29. for i := range messages {
  30. fmt.Printf("%+v\n", messages[i])
  31. }
  32. }
  33. func Test_messageDao_tableName(t *testing.T) {
  34. fmt.Println(MessageRepo.tableName(1001))
  35. }