func (f *Field) Set(value string, version uint64) error {
	if version != 0 && version <= f.version {
		log.Warnf("version %d is older or same as the field's %s", version, f.name)
		return nil
	}
	var arg interface{}
	switch f.tp {
	case "Bool":
		v, err := strconv.ParseBool(value)
		if err != nil {
			return err
		}
		arg = v
	case "String":
		arg = value
	case "Int64":
		v, err := strconv.ParseInt(value, 10, 64)
		if err != nil {
			return err
		}
		arg = v
	case "Float64":
		v, err := strconv.ParseFloat(value, 64)
		if err != nil {
			return err
		}
		arg = v
	}
	rr := f.setter.Call([]reflect.Value{reflect.ValueOf(arg)})
	if len(rr) > 0 {
		return fmt.Errorf("the set call returned %d values: %v", len(rr), rr)
	}
	f.version = version
	log.Infof("field %s updated with value %s, version: %d", f.name, value, version)
	return nil
}
// Set the value of the field.
Set the value of the field.
// Set the value of the field .
func (f *Field) Set(value string, version uint64) error {
	if version != 0 && version <= f.version {
		log.Warnf("version %d is older or same as the field's %s", version, f.name)
		return nil
	}
	var arg interface{}
	switch f.tp {
	case "Bool":
		v, err := strconv.ParseBool(value)
		if err != nil {
			return err
		}
		arg = v
	case "String":
		arg = value
	case "Int64":
		v, err := strconv.ParseInt(value, 10, 64)
		if err != nil {
			return err
		}
		arg = v
	case "Float64":
		v, err := strconv.ParseFloat(value, 64)
		if err != nil {
			return err
		}
		arg = v
	}
	rr := f.setter.Call([]reflect.Value{reflect.ValueOf(arg)})
	if len(rr) > 0 {
		return fmt.Errorf("the set call returned %d values: %v", len(rr), rr)
	}
	f.version = version
	log.Infof("field %s updated with value %s, version: %d", f.name, value, version)
	return nil
}
func ( f * Field ) Set ( value string , version uint64 ) error { if version != 0 && version <= f . version { log . Warnf ( " " , version , f . name ) return nil } var arg interface { } switch f . tp { case " " : v , err := strconv . ParseBool ( value ) if err != nil { return err } arg = v case " " : arg = value case " " : v , err := strconv . ParseInt ( value , 10 , 64 ) if err != nil { return err } arg = v case " " : v , err := strconv . ParseFloat ( value , 64 ) if err != nil { return err } arg = v } rr := f . setter . Call ( [ ] reflect . Value { reflect . ValueOf ( arg ) } ) if len ( rr ) > 0 { return fmt . Errorf ( " " , len ( rr ) , rr ) } f . version = version log . Infof ( " " , f . name , value , version ) return nil }
Set the value of the field.
Set the value of the field .