Releases: xgfone/gconf
Releases · xgfone/gconf
v5.0.0
- Added:
- Add the method
UnregisterOpts
forOptGroup
to unregister the registered options. - Add the method
LoadDataSetCallback
forConfig
to be used the watcher of the source.
- Add the method
- Changed:
Set
,UpdateValue
andUpdateOptValue
return an error if failing to update the option.LoadMap
,LoadDataSet
,,
return an error if failing to load the configurations.RegisterOpts
panics instead of returning the bool if the option has been registered.Snapshot
no longer contains the default values of the options.- Move the type
XXXOptField
to the sub-packagefield
. - Change the signature of the method
Watch
ofSource
from
Watch(load func(DataSet, error), close <-chan struct{})
to
Watch(load func(DataSet, error) bool, close <-chan struct{})
- Removed:
- Remove the field
Callback
fromDataSet
. - Remove the method
RegisterOpt
fromOptGroup
. - Remove the observer of the opt registering, that's
ObserveRegister
. - Remove the methods
LoadSourceAndCallback
andLoadSourceAndCallbackWithoutWatch
fromConfig
.
- Remove the field
v4.3.0
- Added:
- Add the aliases for
cli.Flag
. - Predefine some constant validators, such as
AddressValidator
,EmailValidator
,IPValidator
,URLValidator
, etc.
- Add the aliases for
- Changed:
- Update the dependencies:
- Use
github.com/urfave/cli/v2
instead ofgithub.com/urfave/cli
. - Use
github.com/xgfone/cast
instead ofgithub.com/xgfone/go-tools/v6/types
.
- Use
- Update the dependencies:
v4.2.0
- Added:
- Add the
Fix
field forOpt
, which is different fromParser
:Parser
only parses the value from the arbitrary type to a specific type.Fix
only changes the value, not the type, that's, input and output should be the same type.
- Add some new validators, such as
NewMaybeURLValidator
,NewMaybeIPValidator
,NewMaybeEmailValidator
,NewMaybeAddressValidator
,NewMaybeAddressOrIPValidator
,NewAddressOrIPValidator
andNewAddressOrIPSliceValidator
.
- Add the
v4.1.0
- Added:
- Add the migration of the option to other option in the other group. For example,
Group("g1").Migrate("opt1", "g1.opt2")
will migrate the optionopt1
in the groupg1
to the optionopt2
in the groupg2
, that's, when updating "g1.opt1", "g2.opt2" will be updated to the same new value, too.
- Add the migration of the option to other option in the other group. For example,
- Changed:
- Enhance the address validator
NewAddressValidator
. - Reduce the range of the group lock to avoid the deadlock when updating the option value in observer.
- Enhance the address validator
v4.0.1
v4.0.0
- Added:
- Add the observers for
Opt
, which will be called when the value of the option is updated. - Support Semantic Import Versioning, and move the imported path from
github.com/xgfone/gconf
togithub.com/xgfone/gconf/v4
.
- Add the observers for
Notice: This released version is bad in the GOPROXY
and GOSUMDB
. Please use the next release.
v3.7.0
- Added:
- Add the global variable
DefaultWriter
to customize the output of the information. - Add the tags for
Opt
as the extra metadata information. - Add the aliases for
Opt
, which are added intoOptGroup.SetOptAlias
, and vice versa. - Add the Cli flag for
Opt
to indicate that the option may be as the cli flag. Thecli
andflag
source only add the options that the Cli istrue
. - Add the method
MustXXX(name)
to must get the option, which are equal toGetXXX(name)
but panic if the option does not exist. - Add the method
MustGroup(group)
andMustG(group)
to must get the group, which are equal toGroup(group)
but panic if the option does not exist. - Add the new slice validators, such as
NewStrSliceValidator
,NewURLSliceValidator
,NewIPSliceValidator
,NewEmailSliceValidator
,NewAddressSliceValidator
.
- Add the global variable
- Changed:
- Use
ToStringSlice
ingithub.com/xgfone/go-tools/types
to split the string to the slice, which will split she string by the whitespace and the comma. NewGroup
supports to create the nest group, For instance,NewGroup("group1.group2")
is equal toNewGroup("group1").NewGroup("group2")
.
- Use
- Fixed:
- Validator should validate the parsed value.
v3.6.0
- Added:
- Add the method
Traverse
to traverse all options in all groups. - Enhance the constraint of the option:
- When setting the default value by
D
, it will be parsed by theParser
if it exists. - When setting the parser by
P
, it will parse theDefault
if it has one default value.
- When setting the default value by
- Add the method
v3.5.0
- Added:
- Set the default of the
VersionOpt
option to1.0.0
. - Add
NewZkConnSource
to reuse the connection toZooKeeper
. - Add the
OptField
type to get or set the value of the struct field concurrently and safely. - Add the support of the short name of the option when converting the options to
cli.Flag
.
- Set the default of the