當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Cloner.DeepCopy方法代碼示例

本文整理匯總了Golang中k8s/io/client-go/1/4/pkg/conversion.Cloner.DeepCopy方法的典型用法代碼示例。如果您正苦於以下問題:Golang Cloner.DeepCopy方法的具體用法?Golang Cloner.DeepCopy怎麽用?Golang Cloner.DeepCopy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在k8s/io/client-go/1/4/pkg/conversion.Cloner的用法示例。


在下文中一共展示了Cloner.DeepCopy方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: DeepCopy_authentication_UserInfo

func DeepCopy_authentication_UserInfo(in interface{}, out interface{}, c *conversion.Cloner) error {
	{
		in := in.(*UserInfo)
		out := out.(*UserInfo)
		out.Username = in.Username
		out.UID = in.UID
		if in.Groups != nil {
			in, out := &in.Groups, &out.Groups
			*out = make([]string, len(*in))
			copy(*out, *in)
		} else {
			out.Groups = nil
		}
		if in.Extra != nil {
			in, out := &in.Extra, &out.Extra
			*out = make(map[string]ExtraValue)
			for key, val := range *in {
				if newVal, err := c.DeepCopy(&val); err != nil {
					return err
				} else {
					(*out)[key] = *newVal.(*ExtraValue)
				}
			}
		} else {
			out.Extra = nil
		}
		return nil
	}
}
開發者ID:AdoHe,項目名稱:kubernetes,代碼行數:29,代碼來源:zz_generated.deepcopy.go

示例2: DeepCopy_unversioned_Time

func DeepCopy_unversioned_Time(in interface{}, out interface{}, c *conversion.Cloner) error {
	{
		in := in.(*Time)
		out := out.(*Time)
		if newVal, err := c.DeepCopy(&in.Time); err != nil {
			return err
		} else {
			out.Time = *newVal.(*time.Time)
		}
		return nil
	}
}
開發者ID:CodeJuan,項目名稱:kubernetes,代碼行數:12,代碼來源:zz_generated.deepcopy.go

示例3: DeepCopy_rbac_PolicyRule

func DeepCopy_rbac_PolicyRule(in interface{}, out interface{}, c *conversion.Cloner) error {
	{
		in := in.(*PolicyRule)
		out := out.(*PolicyRule)
		if in.Verbs != nil {
			in, out := &in.Verbs, &out.Verbs
			*out = make([]string, len(*in))
			copy(*out, *in)
		} else {
			out.Verbs = nil
		}
		if in.AttributeRestrictions == nil {
			out.AttributeRestrictions = nil
		} else if newVal, err := c.DeepCopy(&in.AttributeRestrictions); err != nil {
			return err
		} else {
			out.AttributeRestrictions = *newVal.(*runtime.Object)
		}
		if in.APIGroups != nil {
			in, out := &in.APIGroups, &out.APIGroups
			*out = make([]string, len(*in))
			copy(*out, *in)
		} else {
			out.APIGroups = nil
		}
		if in.Resources != nil {
			in, out := &in.Resources, &out.Resources
			*out = make([]string, len(*in))
			copy(*out, *in)
		} else {
			out.Resources = nil
		}
		if in.ResourceNames != nil {
			in, out := &in.ResourceNames, &out.ResourceNames
			*out = make([]string, len(*in))
			copy(*out, *in)
		} else {
			out.ResourceNames = nil
		}
		if in.NonResourceURLs != nil {
			in, out := &in.NonResourceURLs, &out.NonResourceURLs
			*out = make([]string, len(*in))
			copy(*out, *in)
		} else {
			out.NonResourceURLs = nil
		}
		return nil
	}
}
開發者ID:CodeJuan,項目名稱:kubernetes,代碼行數:49,代碼來源:zz_generated.deepcopy.go

示例4: DeepCopy_authorization_SubjectAccessReviewSpec

func DeepCopy_authorization_SubjectAccessReviewSpec(in interface{}, out interface{}, c *conversion.Cloner) error {
	{
		in := in.(*SubjectAccessReviewSpec)
		out := out.(*SubjectAccessReviewSpec)
		if in.ResourceAttributes != nil {
			in, out := &in.ResourceAttributes, &out.ResourceAttributes
			*out = new(ResourceAttributes)
			**out = **in
		} else {
			out.ResourceAttributes = nil
		}
		if in.NonResourceAttributes != nil {
			in, out := &in.NonResourceAttributes, &out.NonResourceAttributes
			*out = new(NonResourceAttributes)
			**out = **in
		} else {
			out.NonResourceAttributes = nil
		}
		out.User = in.User
		if in.Groups != nil {
			in, out := &in.Groups, &out.Groups
			*out = make([]string, len(*in))
			copy(*out, *in)
		} else {
			out.Groups = nil
		}
		if in.Extra != nil {
			in, out := &in.Extra, &out.Extra
			*out = make(map[string]ExtraValue)
			for key, val := range *in {
				if newVal, err := c.DeepCopy(&val); err != nil {
					return err
				} else {
					(*out)[key] = *newVal.(*ExtraValue)
				}
			}
		} else {
			out.Extra = nil
		}
		return nil
	}
}
開發者ID:invenfantasy,項目名稱:kubernetes,代碼行數:42,代碼來源:zz_generated.deepcopy.go

示例5: DeepCopy_runtime_RawExtension

func DeepCopy_runtime_RawExtension(in interface{}, out interface{}, c *conversion.Cloner) error {
	{
		in := in.(*RawExtension)
		out := out.(*RawExtension)
		if in.Raw != nil {
			in, out := &in.Raw, &out.Raw
			*out = make([]byte, len(*in))
			copy(*out, *in)
		} else {
			out.Raw = nil
		}
		if in.Object == nil {
			out.Object = nil
		} else if newVal, err := c.DeepCopy(&in.Object); err != nil {
			return err
		} else {
			out.Object = *newVal.(*Object)
		}
		return nil
	}
}
開發者ID:CodeJuan,項目名稱:kubernetes,代碼行數:21,代碼來源:zz_generated.deepcopy.go


注:本文中的k8s/io/client-go/1/4/pkg/conversion.Cloner.DeepCopy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。