Esempio n. 1
0
func main() {
	c := config.ParseConfigs()
	db := gsql.OpenDB(c.DBInfo.Address, c.DBInfo.Username, c.DBInfo.Password, c.DBInfo.Name)
	ca := cache.NewRedisCache(c.RedisInfo.Address, c.RedisInfo.Password, c.RedisInfo.Expires)
	services.InitServices(ca, db)
	lis, err := net.Listen("tcp", fmt.Sprintf(":%d", c.Port))
	if err != nil {
		log.Panic(err)
	}
	s := grpc.NewServer()
	pb.RegisterAccountsServer(s, &AccountsService{})
	s.Serve(lis)
}
Esempio n. 2
0
func TestMain(m *testing.M) {
	db := sql.OpenDB("localhost:3306", "root", "", "acc_test")
	persistence.InitDB(db)
	os.Exit(m.Run())
}