用AI赚第一桶💰低成本搭建一套AI赚钱工具,源码可二开。 广告
[TOC] > https://github.com/uber-go/fx ## 概述 - dig fx基于反射,运行时注入 - 让程序的参数再运行时自动写入初始化函数中,避免当过多时,时传变的复杂 error ``` configFile := cmdFlags.get("--config") configObject := readConfig(configFile) mysqlConn ,err := mysql.Connect(configObject.mysql) userModel := NewuserModel(mysqlConn) redisConn ,err := redis.Connect(configObject.redis) cache := NewCache(redisConn) httpServer ,err := http.New(configObject.http) httpServer.Router("/user/any",NewUserControl(userModel,cache)) httpServer.Start() <-sig httpServer.Stop() redisConn.Close() mysqlConn.Close() ``` good 请按顺序查看此目录下的子目录