setting

package
v0.0.0-...-021ab65 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 9 Imported by: 0

README

配置中心

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize(rds *redis.Client, env string) error

func Monitor

func Monitor()

Monitor 用于监听是否更新配置信息, 建议采用 goroutine

Types

type ServiceSetting

type ServiceSetting struct {
	// contains filtered or unexported fields
}
var Global *ServiceSetting

func (*ServiceSetting) GetAllSetting

func (s *ServiceSetting) GetAllSetting() (map[string]record, error)

func (*ServiceSetting) LoadRedisData

func (s *ServiceSetting) LoadRedisData(ctx context.Context) error

LoadRedisData 加载 redis 配置, 通过redis标签读取key,从 HGetAll 的 map 找到数据值, 通过反射将对应的成员中的属性 Value 复制为 redis的值

func (*ServiceSetting) ParseTag

func (s *ServiceSetting) ParseTag() error

ParseTag 通过反射读取tag中包含的信息

func (*ServiceSetting) UpdateRecord

func (s *ServiceSetting) UpdateRecord(ctx context.Context, data fieldInterface) error

Jump to

Keyboard shortcuts

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