/config.go

https://github.com/gohouse/gorose · Go · 20 lines · 14 code · 2 blank · 4 comment · 0 complexity · 0cd32e30ce165e7d1552182dbde9ccb2 MD5 · raw file

  1. package gorose
  2. // Config ...
  3. type Config struct {
  4. Driver string `json:"driver"` // 驱动: mysql/sqlite3/oracle/mssql/postgres/clickhouse, 如果集群配置了驱动, 这里可以省略
  5. // mysql 示例:
  6. // root:root@tcp(localhost:3306)/test?charset=utf8mb4&parseTime=true
  7. Dsn string `json:"dsn"` // 数据库链接
  8. SetMaxOpenConns int `json:"setMaxOpenConns"` // (连接池)最大打开的连接数,默认值为0表示不限制
  9. SetMaxIdleConns int `json:"setMaxIdleConns"` // (连接池)闲置的连接数, 默认0
  10. Prefix string `json:"prefix"` // 表前缀, 如果集群配置了前缀, 这里可以省略
  11. }
  12. // ConfigCluster ...
  13. type ConfigCluster struct {
  14. Master []Config // 主
  15. Slave []Config // 从
  16. Driver string // 驱动
  17. Prefix string // 前缀
  18. }