Documentation
¶
Index ¶
- Variables
- func SetValue(name string, value any) error
- type Bool
- func (b *Bool) Default() bool
- func (b *Bool) DefaultInterface() any
- func (b *Bool) DefaultString() string
- func (b *Bool) Get() bool
- func (d *Bool) Group() model.SettingGroup
- func (b *Bool) Init(value string) error
- func (b *Bool) Interface() any
- func (d *Bool) Name() string
- func (b *Bool) Parse(value string) (bool, error)
- func (b *Bool) Set(value bool) (err error)
- func (b *Bool) SetString(value string) error
- func (b *Bool) String() string
- func (b *Bool) Stringify(value bool) string
- func (d *Bool) Type() model.SettingType
- type BoolSetting
- type BoolSettingOption
- type Float64
- func (f *Float64) Default() float64
- func (f *Float64) DefaultInterface() any
- func (f *Float64) DefaultString() string
- func (f *Float64) Get() float64
- func (d *Float64) Group() model.SettingGroup
- func (f *Float64) Init(value string) error
- func (f *Float64) Interface() any
- func (d *Float64) Name() string
- func (f *Float64) Parse(value string) (float64, error)
- func (f *Float64) Set(value float64) (err error)
- func (f *Float64) SetString(value string) error
- func (f *Float64) String() string
- func (f *Float64) Stringify(value float64) string
- func (d *Float64) Type() model.SettingType
- type Float64Setting
- type Float64SettingOption
- type Int64
- func (i *Int64) Default() int64
- func (i *Int64) DefaultInterface() any
- func (i *Int64) DefaultString() string
- func (i *Int64) Get() int64
- func (d *Int64) Group() model.SettingGroup
- func (i *Int64) Init(value string) error
- func (i *Int64) Interface() any
- func (d *Int64) Name() string
- func (i *Int64) Parse(value string) (int64, error)
- func (i *Int64) Set(value int64) (err error)
- func (i *Int64) SetString(value string) error
- func (i *Int64) String() string
- func (i *Int64) Stringify(value int64) string
- func (d *Int64) Type() model.SettingType
- type Int64Setting
- type Int64SettingOption
- type Setting
- type String
- func (s *String) Default() string
- func (s *String) DefaultInterface() any
- func (s *String) DefaultString() string
- func (s *String) Get() string
- func (d *String) Group() model.SettingGroup
- func (s *String) Init(value string) error
- func (s *String) Interface() any
- func (d *String) Name() string
- func (s *String) Parse(value string) (string, error)
- func (s *String) Set(value string) (err error)
- func (s *String) SetString(value string) error
- func (s *String) String() string
- func (s *String) Stringify(value string) string
- func (d *String) Type() model.SettingType
- type StringSetting
- type StringSettingOption
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Settings = make(map[string]Setting) GroupSettings = make(map[model.SettingGroup][]Setting) )
View Source
var ( DisableCreateRoom = NewBoolSetting("disable_create_room", false, model.SettingGroupRoom) RoomMustNeedPwd = NewBoolSetting("room_must_need_pwd", false, model.SettingGroupRoom) CreateRoomNeedReview = NewBoolSetting("create_room_need_review", false, model.SettingGroupRoom) RoomTTL = NewInt64Setting("room_ttl", int64(time.Hour*48), model.SettingGroupRoom) UserMaxRoomCount = NewInt64Setting("user_max_room_count", 3, model.SettingGroupRoom) )
View Source
var ( DisableUserSignup = NewBoolSetting("disable_user_signup", false, model.SettingGroupUser) SignupNeedReview = NewBoolSetting("signup_need_review", false, model.SettingGroupUser) )
View Source
var ( MovieProxy = NewBoolSetting("movie_proxy", true, model.SettingGroupProxy) LiveProxy = NewBoolSetting("live_proxy", true, model.SettingGroupProxy) AllowProxyToLocal = NewBoolSetting("allow_proxy_to_local", false, model.SettingGroupProxy) )
View Source
var ( // can watch live streams through the RTMP protocol (without authentication, insecure). RtmpPlayer = NewBoolSetting("rtmp_player", false, model.SettingGroupRtmp) // default use http header host CustomPublishHost = NewStringSetting("custom_publish_host", "", model.SettingGroupRtmp) // disguise the .ts file as a .png file TsDisguisedAsPng = NewBoolSetting("ts_disguised_as_png", true, model.SettingGroupRtmp) )
View Source
var ( DatabaseVersion = NewStringSetting("database_version", "0.0.1", model.SettingGroupDatabase, WithBeforeSetString(func(ss StringSetting, s string) error { return errors.New("not support change database version") })) )
Functions ¶
Types ¶
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
func (*Bool) DefaultInterface ¶
func (*Bool) DefaultString ¶
func (*Bool) Group ¶
func (d *Bool) Group() model.SettingGroup
func (*Bool) Type ¶
func (d *Bool) Type() model.SettingType
type BoolSetting ¶
type BoolSetting interface {
Setting
Set(bool) error
Get() bool
Default() bool
Parse(string) (bool, error)
Stringify(bool) string
}
func NewBoolSetting ¶
func NewBoolSetting(k string, v bool, g model.SettingGroup, options ...BoolSettingOption) BoolSetting
type BoolSettingOption ¶
type BoolSettingOption func(*Bool)
func WithBeforeInitBool ¶
func WithBeforeInitBool(beforeInit func(BoolSetting, bool) error) BoolSettingOption
func WithBeforeSetBool ¶
func WithBeforeSetBool(beforeSet func(BoolSetting, bool) error) BoolSettingOption
type Float64 ¶
type Float64 struct {
// contains filtered or unexported fields
}
func NewFloat64Setting ¶
func NewFloat64Setting(k string, v float64, g model.SettingGroup, options ...Float64SettingOption) *Float64
func (*Float64) DefaultInterface ¶
func (*Float64) DefaultString ¶
func (*Float64) Group ¶
func (d *Float64) Group() model.SettingGroup
func (*Float64) Type ¶
func (d *Float64) Type() model.SettingType
type Float64Setting ¶
type Float64SettingOption ¶
type Float64SettingOption func(*Float64)
func WithBeforeInitFloat64 ¶
func WithBeforeInitFloat64(beforeInit func(Float64Setting, float64) error) Float64SettingOption
func WithBeforeSetFloat64 ¶
func WithBeforeSetFloat64(beforeSet func(Float64Setting, float64) error) Float64SettingOption
func WithValidatorFloat64 ¶
func WithValidatorFloat64(validator func(float64) error) Float64SettingOption
type Int64 ¶
type Int64 struct {
// contains filtered or unexported fields
}
func NewInt64Setting ¶
func NewInt64Setting(k string, v int64, g model.SettingGroup, options ...Int64SettingOption) *Int64
func (*Int64) DefaultInterface ¶
func (*Int64) DefaultString ¶
func (*Int64) Group ¶
func (d *Int64) Group() model.SettingGroup
func (*Int64) Type ¶
func (d *Int64) Type() model.SettingType
type Int64Setting ¶
type Int64SettingOption ¶
type Int64SettingOption func(*Int64)
func WithBeforeInitInt64 ¶
func WithBeforeInitInt64(beforeInit func(Int64Setting, int64) error) Int64SettingOption
func WithBeforeSetInt64 ¶
func WithBeforeSetInt64(beforeSet func(Int64Setting, int64) error) Int64SettingOption
func WithValidatorInt64 ¶
func WithValidatorInt64(validator func(int64) error) Int64SettingOption
type String ¶
type String struct {
// contains filtered or unexported fields
}
func NewStringSetting ¶
func NewStringSetting(k string, v string, g model.SettingGroup, options ...StringSettingOption) *String
func (*String) DefaultInterface ¶
func (*String) DefaultString ¶
func (*String) Group ¶
func (d *String) Group() model.SettingGroup
func (*String) Type ¶
func (d *String) Type() model.SettingType
type StringSetting ¶
type StringSettingOption ¶
type StringSettingOption func(*String)
func WithBeforeInitString ¶
func WithBeforeInitString(beforeInit func(StringSetting, string) error) StringSettingOption
func WithBeforeSetString ¶
func WithBeforeSetString(beforeSet func(StringSetting, string) error) StringSettingOption
func WithValidatorString ¶
func WithValidatorString(validator func(string) error) StringSettingOption
Click to show internal directories.
Click to hide internal directories.