Example #1
0
File: generated.go Project: kego/ke
func (v *Hero) 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/site", "hero"); err != nil {
		return err
	}
	if field, ok := in.Map()["head"]; ok && field.Type() != system.J_NULL {
		ob0, err := system.UnpackStringInterface(ctx, field)
		if err != nil {
			return err
		}
		v.Head = ob0
	}
	if field, ok := in.Map()["image"]; ok && field.Type() != system.J_NULL {
		ob0, err := images.UnpackImage(ctx, field)
		if err != nil {
			return err
		}
		v.Image = ob0
	}
	if field, ok := in.Map()["subhead"]; ok && field.Type() != system.J_NULL {
		ob0, err := system.UnpackStringInterface(ctx, field)
		if err != nil {
			return err
		}
		v.Subhead = ob0
	}
	return nil
}
Example #2
0
File: generated.go Project: kego/ke
func (v *Body) 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/site", "body"); err != nil {
		return err
	}
	if field, ok := in.Map()["align"]; ok && field.Type() != system.J_NULL {
		ob0 := new(system.String)
		if err := ob0.Unpack(ctx, field, false); err != nil {
			return err
		}
		v.Align = ob0
	}
	if field, ok := in.Map()["copy"]; ok && field.Type() != system.J_NULL {
		ob0, err := system.UnpackStringInterface(ctx, field)
		if err != nil {
			return err
		}
		v.Copy = ob0
	}
	if field, ok := in.Map()["title"]; ok && field.Type() != system.J_NULL {
		ob0, err := system.UnpackStringInterface(ctx, field)
		if err != nil {
			return err
		}
		v.Title = ob0
	}
	return nil
}
Example #3
0
File: generated.go Project: kego/ke
func (v *B) 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", "b"); err != nil {
		return err
	}
	if field, ok := in.Map()["c"]; ok && field.Type() != system.J_NULL {
		ob0, err := system.UnpackStringInterface(ctx, field)
		if err != nil {
			return err
		}
		v.C = ob0
	}
	return nil
}
Example #4
0
File: generated.go Project: kego/ke
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/site", "page"); err != nil {
		return err
	}
	if field, ok := in.Map()["sections"]; 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 := []Section{}
		for i0 := range field.Array() {
			ob1, err := UnpackSection(ctx, field.Array()[i0])
			if err != nil {
				return err
			}
			ob0 = append(ob0, ob1)
		}
		v.Sections = ob0
	}
	if field, ok := in.Map()["title"]; ok && field.Type() != system.J_NULL {
		ob0, err := system.UnpackStringInterface(ctx, field)
		if err != nil {
			return err
		}
		v.Title = ob0
	}
	return nil
}