From a83ccf7c00faf4c4767e3c9d52649c073d3e120e Mon Sep 17 00:00:00 2001 From: charlie <3140647@qq.com> Date: Wed, 13 Dec 2023 17:26:23 +0800 Subject: [PATCH] config --- configure/configure.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/configure/configure.go b/configure/configure.go index f9cb7fb..4ed2ec3 100644 --- a/configure/configure.go +++ b/configure/configure.go @@ -5,11 +5,13 @@ import ( "github.com/spf13/viper" ) -type Configure interface { - GetString(string, string) string -} +type NotifyFunc func(Configure) error -type NotifyFunc func(Configure) +type Configure interface { + Load(dataId string, v any, onChanged ...NotifyFunc) error + GetString(string, string) string + GetInt(key string, defaultValue int) int +} type conf struct { viper *viper.Viper //