// ReturnValue constructs a wamp response which contains just one arbitrary value.
// Its primary use is to save boilerplate code.
553770
func ReturnValue(value interface{}) *client.InvokeResult {
	return &client.InvokeResult{
		Args: wamp.List{
			value,
		},
	}
}
452203
func (t *Transaction) Return(resultVar string) *Transaction {
	t.returnVar = resultVar
	return t
}
1113122
func (a *EvaluateOnCallFrameArgs) SetReturnByValue(returnByValue bool) *EvaluateOnCallFrameArgs {
	a.ReturnByValue = &returnByValue
	return a
}
177658
func toValue(p interface{}) reflect.Value {
	v := reflect.ValueOf(p)
	if v.Kind() == reflect.Ptr {
		v = v.Elem()
	}
	return v
}
986097
func handleReturnValue(out []reflect.Value) (interface{}, error) {
	switch len(out) {
	case 2:
		err := out[1]
		if err != (reflect.Value{}) && !err.IsNil() {
			return nil, err.Interface().(error)
		}
		fallthrough
	case 1:
		tpt := out[0]

		// Check for nil value and nil error.
		if tpt == (reflect.Value{}) {
			return nil, fmt.Errorf("unspecified error")
		}
		switch tpt.Kind() {
		case reflect.Ptr, reflect.Interface, reflect.Func:
			if tpt.IsNil() {
				return nil, fmt.Errorf("unspecified error")
			}
		}

		return tpt.Interface(), nil
	default:
		panic("expected 1 or 2 return values from transport constructor")
	}
}
22247
func (r *Random) GetValue(_ int) float64 {
	if r.min != nil && r.max != nil {
		var delta float64

		if *r.max > *r.min {
			delta = *r.max - *r.min
		} else {
			delta = *r.min - *r.max
		}

		return *r.min + (r.rnd.Float64() * delta)
	} else if r.max != nil {
		return r.rnd.Float64() * *r.max
	} else if r.min != nil {
		return *r.min + (r.rnd.Float64())
	}
	return r.rnd.Float64()
}
314670
func (rp *Reply) StatusValue() (string, error) {
	if rp.Type == ErrorReply {
		return "", errors.New(rp.Error)
	}
	if rp.Type != StatusReply {
		return "", errors.New("invalid reply type, not status")
	}
	return rp.Status, nil
}
1327202
func AsValue(v interface{}) (out Value, ok bool) {
	if v == nil {
		return nil, true
	}
	switch v := v.(type) {
	case Value:
		out = v
	case string:
		out = String(v)
	case int:
		out = Int(v)
	case int8:
		out = Int(v)
	case int16:
		out = Int(v)
	case int32:
		out = Int(v)
	case int64:
		out = Int(v)
	case uint:
		out = Int(v)
	case uint8:
		out = Int(v)
	case uint16:
		out = Int(v)
	case uint32:
		out = Int(v)
	case uint64:
		out = Int(v)
	case float64:
		out = Float(v)
	case float32:
		out = Float(v)
	case bool:
		out = Bool(v)
	case time.Time:
		out = Time(v)
	default:
		return nil, false
	}
	return out, true
}
1238764
func (kv *KeyValBytes) GetValue(message proto.Message) error {
	return json.Unmarshal(kv.value, message)
}
1115315
func (builder *Builder) Returning(field string) *Builder {
	builder.returnField = field
	return builder
}
403504
func writeValue(w io.Writer, v interface{}) (err error) {
	switch v := v.(type) {
	case nil:
		_, err = w.Write([]byte("null"))
	case string:
		if strings.IndexFunc(v, needsQuotedValueRune) != -1 {
			var b []byte
			b, err = json.Marshal(v)
			if err == nil {
				w.Write(b)
			}
		} else {
			_, err = w.Write([]byte(v))
		}
	case error:
		s := v.Error()
		err = writeValue(w, s)
	default:
		s := fmt.Sprint(v)
		err = writeValue(w, s)
	}
	return
}
884059
func (rp *Reply) StringValue() (string, error) {
	if rp.Type == ErrorReply {
		return "", errors.New(rp.Error)
	}
	if rp.Type != BulkReply {
		return "", errors.New("invalid reply type, not bulk")
	}
	if rp.Bulk == nil {
		return "", nil
	}
	return string(rp.Bulk), nil
}
1153770
func (r *ProtoKeyValWrapper) GetValue(value proto.Message) error {
	err := r.ProtoKeyVal.GetValue(value)
	if err != nil {
		return err
	}
	_, err = r.decrypter.Decrypt(value, r.decryptFunc)
	return err
}
1204828
func BytesValue(val string) (*wrappers.BytesValue, error) {
	parsedVal, err := Bytes(val)
	return &wrappers.BytesValue{Value: parsedVal}, err
}
1172926
func (c *Debugger) SetReturnValue(newValue *RuntimeCallArgument) (*gcdmessage.ChromeResponse, error) {
	var v DebuggerSetReturnValueParams
	v.NewValue = newValue
	return c.SetReturnValueWithParams(&v)
}
192643
func (list *List) GetValue() interface{} {
	var values []interface{}
	for _, val := range list.values {
		values = append(values, val.GetValue())
	}
	return values
}
640986
func (v *variable) intValue() int {
	i, err := strconv.Atoi(v.value)
	if err != nil {
		panic("unexpected value " + v.value + " for int ")
	}
	return i
}