Documentation
¶
Overview ¶
* @Author: reel * @Date: 2023-05-16 20:02:15 * @LastEditors: reel * @LastEditTime: 2024-01-13 23:26:46 * @Description: 配置数据库,缓存的链接, 支持本地缓存和本地数据库
Index ¶
- Constants
- type Dsn
- type DsnFunc
- func PGDefaultDsn() DsnFunc
- func SetHost(host string) DsnFunc
- func SetLink(link string) DsnFunc
- func SetLog(log logx.Logger) DsnFunc
- func SetName(name string) DsnFunc
- func SetPath(path string) DsnFunc
- func SetPort(port string) DsnFunc
- func SetPwd(pwd string) DsnFunc
- func SetType(t string) DsnFunc
- func SetUser(user string) DsnFunc
Constants ¶
View Source
const ( DSN_TYPE_LOCAL = "local" DSN_TYPE_SQLITE = "sqlite" DSN_TYPE_REDIS = "redis" DSN_TYPE_MYSQL = "mysql" DSN_TYPE_PGSQL = "postgres" MYSQL_DB_DSN_KYE = "%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=True&loc=Local" PGSQL_DB_DSN_KYE = "user=%s password=%s host=%s port=%s dbname=%s sslmode=disable TimeZone=Asia/Shanghai" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dsn ¶
type Dsn struct { Type string Path string Name string Host string Port string User string Pwd string Log logx.Logger // contains filtered or unexported fields }
func NewCacheDsn ¶
func NewCacheDsn() *Dsn
Click to show internal directories.
Click to hide internal directories.