pusher/pushers/controller_test.go

22 lines
554 B
Go
Raw Normal View History

2024-11-29 21:53:59 +08:00
package pushers
import (
"fmt"
"testing"
"gitea.timerzz.com/kedaya_haitao/pusher/kitex_gen/config"
"gorm.io/driver/postgres"
"gorm.io/gorm"
)
func GetDevDB() (*gorm.DB, error) {
dsn := fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%s sslmode=disable TimeZone=Asia/Shanghai", "192.168.31.55", "timerzz", "zhhg1997", "kedaya_dev", "5432")
return gorm.Open(postgres.Open(dsn), &gorm.Config{})
}
func TestNewController(t *testing.T) {
db, _ := GetDevDB()
var pushers []config.PusherConfig
_ = db.Find(&pushers)
fmt.Println(pushers)
}