企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## 定义 在项目config目录下定义每个配置文件 mysql配置文件`config/mysql.go` ``` package config const ( MysqlHostName = "127.0.0.1" MysqlDb = "dbname" MysqlUser = "root" MysqlPassWord = "root" MysqlCharSet = "utf8" MysqlPrefix = "go_" ) ``` redis配置文件`config/redis.go` ``` package config const ( RedisAddr = "127.0.0.1:6379" RedisPassWord = "" RedisDb = 0 RedisPoolSize = 30 RedisMinIdleConns = 30 ) ``` 返回状态码配置文件`config/responseCode.go` ``` package config const ( Ok = 200 Error = 500 Logout = 600 ) ``` ## 使用 在需要使用的地方引入config包 ``` import "project/config" config.Ok ```