本文整理匯總了Golang中kego/io/system.String類的典型用法代碼示例。如果您正苦於以下問題:Golang String類的具體用法?Golang String怎麽用?Golang String使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了String類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Unpack
func (v *Page) Unpack(ctx context.Context, in system.Packed, iface bool) error {
if in == nil || in.Type() == system.J_NULL {
return nil
}
if v.Object == nil {
v.Object = new(system.Object)
}
if err := v.Object.Unpack(ctx, in, false); err != nil {
return err
}
if err := v.Object.InitializeType("kego.io/demo/demo2", "page"); err != nil {
return err
}
if field, ok := in.Map()["hero"]; ok && field.Type() != system.J_NULL {
ob0 := new(images.Photo)
if err := ob0.Unpack(ctx, field, false); err != nil {
return err
}
v.Hero = ob0
}
if field, ok := in.Map()["title"]; ok && field.Type() != system.J_NULL {
ob0 := new(system.String)
if err := ob0.Unpack(ctx, field, false); err != nil {
return err
}
v.Title = ob0
}
return nil
}
示例2: Unpack
func (v *F) Unpack(ctx context.Context, in system.Packed, iface bool) error {
if in == nil || in.Type() == system.J_NULL {
return nil
}
if v.Object == nil {
v.Object = new(system.Object)
}
if err := v.Object.Unpack(ctx, in, false); err != nil {
return err
}
if err := v.Object.InitializeType("kego.io/process/validate/tests", "f"); err != nil {
return err
}
if field, ok := in.Map()["a"]; ok && field.Type() != system.J_NULL {
ob0 := new(A)
if err := ob0.Unpack(ctx, field, false); err != nil {
return err
}
v.A = ob0
}
if field, ok := in.Map()["b"]; ok && field.Type() != system.J_NULL {
if field.Type() != system.J_ARRAY {
return fmt.Errorf("Unsupported json type %s found while unpacking into an array.", field.Type())
}
ob0 := []*A{}
for i0 := range field.Array() {
ob1 := new(A)
if err := ob1.Unpack(ctx, field.Array()[i0], false); err != nil {
return err
}
ob0 = append(ob0, ob1)
}
v.B = ob0
}
if field, ok := in.Map()["c"]; ok && field.Type() != system.J_NULL {
if field.Type() != system.J_MAP {
return fmt.Errorf("Unsupported json type %s found while unpacking into a map.", field.Type())
}
ob0 := map[string]*A{}
for k0 := range field.Map() {
ob1 := new(A)
if err := ob1.Unpack(ctx, field.Map()[k0], false); err != nil {
return err
}
ob0[k0] = ob1
}
v.C = ob0
}
if field, ok := in.Map()["d"]; ok && field.Type() != system.J_NULL {
ob0 := new(system.String)
if err := ob0.Unpack(ctx, field, false); err != nil {
return err
}
v.D = ob0
}
return nil
}
示例3: Unpack
func (v *Photo) Unpack(ctx context.Context, in system.Packed, iface bool) error {
if in == nil || in.Type() == system.J_NULL {
return nil
}
if v.Object == nil {
v.Object = new(system.Object)
}
if err := v.Object.Unpack(ctx, in, false); err != nil {
return err
}
if err := v.Object.InitializeType("kego.io/demo/demo3/images", "photo"); err != nil {
return err
}
if field, ok := in.Map()["url"]; ok && field.Type() != system.J_NULL {
ob0 := new(system.String)
if err := ob0.Unpack(ctx, field, false); err != nil {
return err
}
v.Url = ob0
}
return nil
}
示例4: Unpack
func (v *Simple) Unpack(ctx context.Context, in system.Packed, iface bool) error {
if in == nil || in.Type() == system.J_NULL {
return nil
}
if v.Object == nil {
v.Object = new(system.Object)
}
if err := v.Object.Unpack(ctx, in, false); err != nil {
return err
}
if err := v.Object.InitializeType("kego.io/demo/demo5/translation", "simple"); err != nil {
return err
}
if field, ok := in.Map()["text"]; ok && field.Type() != system.J_NULL {
ob0 := new(system.String)
if err := ob0.Unpack(ctx, field, false); err != nil {
return err
}
v.Text = ob0
}
return nil
}
示例5: Unpack
func (v *Photo) Unpack(ctx context.Context, in system.Packed, iface bool) error {
if in == nil || in.Type() == system.J_NULL {
return nil
}
if v.Object == nil {
v.Object = new(system.Object)
}
if err := v.Object.Unpack(ctx, in, false); err != nil {
return err
}
if err := v.Object.InitializeType("kego.io/demo/common/images", "photo"); err != nil {
return err
}
if field, ok := in.Map()["path"]; ok && field.Type() != system.J_NULL {
ob0 := new(system.String)
if err := ob0.Unpack(ctx, field, false); err != nil {
return err
}
v.Path = ob0
}
if field, ok := in.Map()["protocol"]; ok && field.Type() != system.J_NULL {
ob0 := new(system.String)
if err := ob0.Unpack(ctx, field, false); err != nil {
return err
}
v.Protocol = ob0
} else {
ob0 := new(system.String)
if err := ob0.Unpack(ctx, system.Pack("http"), false); err != nil {
return err
}
v.Protocol = ob0
}
if field, ok := in.Map()["server"]; ok && field.Type() != system.J_NULL {
ob0 := new(system.String)
if err := ob0.Unpack(ctx, field, false); err != nil {
return err
}
v.Server = ob0
}
if field, ok := in.Map()["size"]; ok && field.Type() != system.J_NULL {
ob0 := new(units.Rectangle)
if err := ob0.Unpack(ctx, field, false); err != nil {
return err
}
v.Size = ob0
}
return nil
}