conf

package
v1.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2024 License: GPL-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOCATION = "Asia/Shanghai"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CanalConfig

type CanalConfig struct {
	Addr     string   `yaml:"addr"`
	User     string   `yaml:"user"`
	Password string   `yaml:"password"`
	TableDB  string   `yaml:"tableDB"`
	Tables   []string `yaml:"tables"`
	// contains filtered or unexported fields
}

func (*CanalConfig) Init

func (e *CanalConfig) Init()

Init 初始化配置

func (*CanalConfig) SetEventHandler

func (e *CanalConfig) SetEventHandler(eventHandler canal.EventHandler)

func (*CanalConfig) SetPost

func (e *CanalConfig) SetPost(pos *mysql.Position)

type DatabaseConfig

type DatabaseConfig struct {
	Separation bool                   `yaml:"separation"` // 是否开启读写分离
	MaxIdle    int                    `yaml:"maxIdle"`    // 最大空闲连接数
	MaxOpen    int                    `yaml:"maxOpen"`    // 最大打开连接数
	Master     string                 `yaml:"master"`     // 主库
	Dynamic    map[string]string      `yaml:"dynamic"`    // 动态库
	Slave      []string               `yaml:"slave"`      // 从库
	Cache      cache.Gorm2CacheConfig `yaml:"cache"`      // 缓存配置
}

func (*DatabaseConfig) Init

func (e *DatabaseConfig) Init(_config *Settings)

Init 初始化配置

type EsConfig

type EsConfig struct {
	Addresses             []string `yaml:"addresses"`             // 地址
	Username              string   `yaml:"username"`              // 用户名
	Password              string   `yaml:"password"`              // 密码
	EnableRequestBodyLog  bool     `yaml:"enableRequestBodyLog"`  // 是否开启调试日志
	EnableResponseBodyLog bool     `yaml:"enableResponseBodyLog"` // 是否开启调试日志
}

func (*EsConfig) Init

func (e *EsConfig) Init(_config *Settings)

Init 初始化配置

type EurekaConfig

type EurekaConfig struct {
	DefaultZone string `yaml:"defaultZone"`
}

func (*EurekaConfig) Init

func (e *EurekaConfig) Init(config *Settings)

Init 初始化配置

type RedisConfig

type RedisConfig struct {
	MasterName     string `yaml:"masterName"`     // Sentinel 哨兵模式 Master名字
	Address        string `yaml:"address"`        // 地址 localhost:6379
	Password       string `yaml:"password"`       // 密码
	DBIds          int    `yaml:"dbIds"`          // redisDB
	MaxIdle        int    `yaml:"maxIdle"`        // redis连接池最大空闲连接数
	MaxActive      int    `yaml:"maxActive"`      // redis连接池最大激活连接数, 0为不限制
	ConnectTimeout int    `yaml:"connectTimeout"` // redis连接超时时间, 单位毫秒
	ReadTimeout    int    `yaml:"readTimeout"`    // redis读取超时时间, 单位毫秒
	WriteTimeout   int    `yaml:"writeTimeout"`   // redis写入超时时间, 单位毫秒
}

func (*RedisConfig) Init

func (e *RedisConfig) Init(config *Settings)

Init 初始化配置

type ServerConfig

type ServerConfig struct {
	Template *struct {
		Directory string `yaml:"directory"` // 模板路径
		Extension string `yaml:"extension"` // 模板后缀
	} `yaml:"template"` // 模板路径
	ReadTimeout      time.Duration `yaml:"readTimeout"`      // 读取超时
	WriteTimeout     time.Duration `yaml:"writeTimeout"`     // 写入超时
	IdleTimeout      time.Duration `yaml:"idleTimeout"`      // 空闲超时
	ReadBufferSize   int           `yaml:"readBufferSize"`   // 读取缓冲区大小
	WriteBufferSize  int           `yaml:"writeBufferSize"`  // 写入缓冲区大小
	Prefork          bool          `yaml:"prefork"`          // 是否启用预分叉
	MaxProcs         int           `yaml:"maxProcs"`         // 最大进程数
	CaseSensitive    bool          `yaml:"caseSensitive"`    // 是否大小写敏感
	DisableKeepalive bool          `yaml:"disableKeepalive"` // 是否禁用keepalive
}

func (*ServerConfig) Init

func (e *ServerConfig) Init(config *Settings)

Init 初始化配置

type Settings

type Settings struct {
	Mode           string                 `yaml:"mode"`       // 运行模式
	AppName        string                 `yaml:"appName"`    // 应用名称
	Port           int                    `yaml:"port"`       // 端口
	Version        string                 `yaml:"version"`    // 版本
	EurekaConfig   *EurekaConfig          `yaml:"eureka"`     // 服务注册
	RedisConfig    *RedisConfig           `yaml:"redis"`      // Redis配置
	ServerConfig   *ServerConfig          `yaml:"server"`     // Gin配置
	DatabaseConfig *DatabaseConfig        `yaml:"dataSource"` // 数据库配置
	CanalConfig    *CanalConfig           `yaml:"canal"`      // Canal配置
	EsConfig       *EsConfig              `yaml:"es"`         // ES配置
	Customize      map[string]interface{} `yaml:"customize"`  // 自定义配置
	FS             *embed.FS              `yaml:"-"`          // embed
}

func (*Settings) Init

func (e *Settings) Init()

Init 初始化配置

func (*Settings) InitCanal

func (e *Settings) InitCanal(pos *mysql.Position, eventHandler canal.EventHandler)

func (*Settings) Run

func (e *Settings) Run()

func (*Settings) SetRouter

func (e *Settings) SetRouter(routers ...sdk.IRouter)

func (*Settings) Setup

func (e *Settings) Setup(env string)

Setup 载入配置文件

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL