From 67657fd49c281ca8810c718042ea8770c4569ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Wed, 15 Jun 2022 12:25:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E4=B9=89redis=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.go | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 config.go diff --git a/config.go b/config.go new file mode 100644 index 0000000..6647826 --- /dev/null +++ b/config.go @@ -0,0 +1,44 @@ +// Package redis ... +// +// Description : redis ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 2022-06-15 11:52 +package redis + +// FullConfig 完整配置 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 12:23 2022/6/15 +type FullConfig struct { + Master *Config `json:"master" yaml:"master"` // 主节点 + Slave *Config `json:"slave" yaml:"slave"` // 从节点 +} + +// Config redis的配置 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 11:52 2022/6/15 +type Config struct { + Host string `yaml:"host" json:"host"` // 地址 + Port int `yaml:"port" json:"port"` // 端口 + DB int `yaml:"db" json:"db"` // db索引 + User string `json:"user" yaml:"user"` // 账号 + Password string `yaml:"password" json:"password"` // 密码 + Timeout Timeout `yaml:"timeout" json:"timeout"` // 超时配置 + MaxConnection int `json:"max_connection" yaml:"max_connection"` // 最大连接数 +} + +// Timeout 超时配置 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 12:19 2022/6/15 +type Timeout struct { + Connect int `yaml:"connect" json:"connect"` // 连接超时 + Read int `yaml:"read" json:"read"` // 读取超时 + Write int `yaml:"write" json:"write"` // 写入超时 +}