mirror of
https://github.com/kubernetes/sample-controller.git
synced 2025-01-21 01:12:51 +08:00
ec723b2112
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. sample-controller: add example CRD controller **What this PR does / why we need it**: Adds a sample-controller example repository fixes #52752 **Special notes for your reviewer**: This is currently based on the sttts:sttts-codegen-scripts branch and should not be merged until that is (ref https://github.com/kubernetes/kubernetes/pull/52186) **Release note**: ``` Add sample-controller repository ``` /cc @sttts @nikhita @colemickens Kubernetes-commit: 9a7800f7d2efb88b397674672ac56f898826cf7c
84 lines
1.2 KiB
Go
84 lines
1.2 KiB
Go
package jsoniter
|
|
|
|
import (
|
|
"strconv"
|
|
)
|
|
|
|
type floatAny struct {
|
|
baseAny
|
|
val float64
|
|
}
|
|
|
|
func (any *floatAny) Parse() *Iterator {
|
|
return nil
|
|
}
|
|
|
|
func (any *floatAny) ValueType() ValueType {
|
|
return NumberValue
|
|
}
|
|
|
|
func (any *floatAny) MustBeValid() Any {
|
|
return any
|
|
}
|
|
|
|
func (any *floatAny) LastError() error {
|
|
return nil
|
|
}
|
|
|
|
func (any *floatAny) ToBool() bool {
|
|
return any.ToFloat64() != 0
|
|
}
|
|
|
|
func (any *floatAny) ToInt() int {
|
|
return int(any.val)
|
|
}
|
|
|
|
func (any *floatAny) ToInt32() int32 {
|
|
return int32(any.val)
|
|
}
|
|
|
|
func (any *floatAny) ToInt64() int64 {
|
|
return int64(any.val)
|
|
}
|
|
|
|
func (any *floatAny) ToUint() uint {
|
|
if any.val > 0 {
|
|
return uint(any.val)
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (any *floatAny) ToUint32() uint32 {
|
|
if any.val > 0 {
|
|
return uint32(any.val)
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (any *floatAny) ToUint64() uint64 {
|
|
if any.val > 0 {
|
|
return uint64(any.val)
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (any *floatAny) ToFloat32() float32 {
|
|
return float32(any.val)
|
|
}
|
|
|
|
func (any *floatAny) ToFloat64() float64 {
|
|
return any.val
|
|
}
|
|
|
|
func (any *floatAny) ToString() string {
|
|
return strconv.FormatFloat(any.val, 'E', -1, 64)
|
|
}
|
|
|
|
func (any *floatAny) WriteTo(stream *Stream) {
|
|
stream.WriteFloat64(any.val)
|
|
}
|
|
|
|
func (any *floatAny) GetInterface() interface{} {
|
|
return any.val
|
|
}
|