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.
 
 
 
 

39 lines
690 B

  1. package device
  2. import (
  3. "fmt"
  4. "gim/pkg/db"
  5. "testing"
  6. )
  7. func init() {
  8. fmt.Println("start")
  9. db.InitByTest()
  10. }
  11. func TestDeviceDao_Add(t *testing.T) {
  12. device := Device{
  13. UserId: 1,
  14. Type: 1,
  15. Brand: "huawei",
  16. Model: "huawei P10",
  17. SystemVersion: "8.0.0",
  18. SDKVersion: "1.0.0",
  19. Status: 1,
  20. }
  21. err := DeviceDao.Save(&device)
  22. fmt.Println(err)
  23. fmt.Println(device)
  24. }
  25. func TestDeviceDao_Get(t *testing.T) {
  26. device, err := DeviceDao.Get(1)
  27. fmt.Printf("%+v\n %+v\n", device, err)
  28. }
  29. func TestDeviceDao_ListOnlineByUserId(t *testing.T) {
  30. devices, err := DeviceDao.ListOnlineByUserId(1)
  31. fmt.Println(err)
  32. fmt.Printf("%+v \n", devices)
  33. }