<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## 調用反射填充對象 ~~~ // reflect.Ptr 指針 // reflect.Struct 結構體 func fillBySettings(obj interface{}, settings map[string]interface{}) error { if reflect.TypeOf(obj).Kind() != reflect.Ptr { return errors.New("st not ptr") } if reflect.TypeOf(obj).Elem().Kind() != reflect.Struct { return errors.New("st not struct") } if settings == nil { return errors.New("setting is nil") } var ok bool var field reflect.StructField for k, v := range settings { if field, ok = reflect.TypeOf(obj).Elem().FieldByName(k); !ok { continue } if field.Type == reflect.TypeOf(v) { reflect.ValueOf(obj).Elem().FieldByName(k).Set(reflect.ValueOf(v)) } } return nil } func TestReflectTypeOfInt(t *testing.T) { let := 10 t.Log(reflect.TypeOf(&let).Kind()) ff := 12.5 t.Log(reflect.TypeOf(&ff).Kind()) } func TestFillBySettings(t *testing.T) { r1 := 10 m1 := make(map[string]interface{}) if err := fillBySettings(&r1, m1); err != nil { t.Log(err) } stu := Student{} m2 := make(map[string]interface{}) m2["Name"] = "weiqiang" m2["Age"] = 20 m2["Weight"] = 60.5 if err := fillBySettings(&stu, m2); err != nil { t.Log(err) } else { t.Log("fill success:", stu) } } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看