Skip to content

Commit

Permalink
OptProxy supports to convert to the concrete typed option proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
xgfone committed Apr 9, 2022
1 parent ce2d262 commit 4e1ab7c
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions opt_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,54 @@ func (o *OptProxy) Parser(parser Parser) *OptProxy {
return o
}

// ToBool converts option from OptProxy to OptProxyBool.
func (o OptProxy) ToBool() *OptProxyBool { return &OptProxyBool{o} }

// ToInt converts option from OptProxy to OptProxyInt.
func (o OptProxy) ToInt() *OptProxyInt { return &OptProxyInt{o} }

// ToInt32 converts option from OptProxy to OptProxyInt32.
func (o OptProxy) ToInt32() *OptProxyInt32 { return &OptProxyInt32{o} }

// ToInt64 converts option from OptProxy to OptProxyInt64.
func (o OptProxy) ToInt64() *OptProxyInt64 { return &OptProxyInt64{o} }

// ToUint converts option from OptProxy to OptProxyUint.
func (o OptProxy) ToUint() *OptProxyUint { return &OptProxyUint{o} }

// ToUint32 converts option from OptProxy to OptProxyUint32.
func (o OptProxy) ToUint32() *OptProxyUint32 { return &OptProxyUint32{o} }

// ToUint64 converts option from OptProxy to OptProxyUint64.
func (o OptProxy) ToUint64() *OptProxyUint64 { return &OptProxyUint64{o} }

// ToFloat64 converts option from OptProxy to OptProxyFloat64.
func (o OptProxy) ToFloat64() *OptProxyFloat64 { return &OptProxyFloat64{o} }

// ToString converts option from OptProxy to OptProxyString.
func (o OptProxy) ToString() *OptProxyString { return &OptProxyString{o} }

// ToDuration converts option from OptProxy to OptProxyDuration.
func (o OptProxy) ToDuration() *OptProxyDuration { return &OptProxyDuration{o} }

// ToTime converts option from OptProxy to OptProxyTime.
func (o OptProxy) ToTime() *OptProxyTime { return &OptProxyTime{o} }

// ToIntSlice converts option from OptProxy to OptProxyIntSlice.
func (o OptProxy) ToIntSlice() *OptProxyIntSlice { return &OptProxyIntSlice{o} }

// ToUintSlice converts option from OptProxy to OptProxyUintSlice.
func (o OptProxy) ToUintSlice() *OptProxyUintSlice { return &OptProxyUintSlice{o} }

// ToFloat64Slice converts option from OptProxy to OptProxyFloat64Slice.
func (o OptProxy) ToFloat64Slice() *OptProxyFloat64Slice { return &OptProxyFloat64Slice{o} }

// ToStringSlice converts option from OptProxy to OptProxyStringSlice.
func (o OptProxy) ToStringSlice() *OptProxyStringSlice { return &OptProxyStringSlice{o} }

// ToDurationSlice converts option from OptProxy to OptProxyDurationSlice.
func (o OptProxy) ToDurationSlice() *OptProxyDurationSlice { return &OptProxyDurationSlice{o} }

////////////////////////////////////////////////////////////////////////////

// NewOptProxy registers the option and returns a new proxy of the option.
Expand Down

0 comments on commit 4e1ab7c

Please sign in to comment.