// Value implements the Valuer interface.
3498
func (sv StringValuer) Value() (string, error) {
	v := string(sv)
	if len(v) == 0 {
		return "", errors.New("[-empty-]")
	}
	return v, nil
}
1307092
func (e Event) Value(v interface{}) error {
	var tmp struct {
		Data interface{} `json:"data"`
	}
	tmp.Data = &v
	return json.Unmarshal(e.rawData, &tmp)
}
543923
func (src *JSON) Value() (driver.Value, error) {
	switch src.Status {
	case Present:
		return src.Bytes, nil
	case Null:
		return nil, nil
	default:
		return nil, errUndefined
	}
}
976458
func (decaying *Decaying) Value() float64 {
	decaying.Lock()
	now := time.Now()
	dt := now.Sub(decaying.t0).Seconds()
	decaying.t0 = now
	curValP := decaying.p
	decaying.p = curValP * math.Pow(decaying.e, (decaying.r*dt))
	pOut := decaying.p
	decaying.Unlock()
	return pOut
}
375084
func (n NullFloat32) Value() (driver.Value, error) {
	if n.Valid {
		return n.Float32, nil
	}
	return nil, nil
}
645979
func (src *Numeric) Value() (driver.Value, error) {
	switch src.Status {
	case pgtype.Present:
		return src.Decimal.Value()
	case pgtype.Null:
		return nil, nil
	default:
		return nil, errUndefined
	}
}
233154
func (t *iterator) Value() []byte {
	if t.i0 < 0 {
		return nil
	}
	return t.buf[t.i0][fVal]
}
666523
func (v Vars) Value() (driver.Value, error) {
	m := make(map[string]sql.NullString)

	for k, v := range v {
		m[string(k)] = sql.NullString{
			Valid:  true,
			String: *v,
		}
	}

	h := hstore.Hstore{
		Map: m,
	}

	return h.Value()
}
1365285
func (c *Context) Value(key interface{}) interface{} {
	if s, ok := key.(string); ok {
		if v, ok := c.data[s]; ok {
			return v
		}
	}
	return c.Context.Value(key)
}
1261427
func Value(keyvals []interface{}, key interface{}) interface{} {
	for i := 0; i < 2*(len(keyvals)/2); i += 2 {
		if keyvals[i] == key {
			return keyvals[i+1]
		}
	}
	return nil
}
1372574
func (src *Numeric) Value() (driver.Value, error) {
	switch src.Status {
	case Present:
		buf, err := src.EncodeText(nil, nil)
		if err != nil {
			return nil, err
		}

		return string(buf), nil
	case Null:
		return nil, nil
	default:
		return nil, errUndefined
	}
}
456884
func (options *Options) Value(name string) interface{} {
	value := options.eval.evalField(options.eval.curCtx(), name, false)
	if !value.IsValid() {
		return nil
	}

	return value.Interface()
}
209492
func (c *Context) Value(key interface{}) interface{} {
	if key == 0 {
		return c.Request
	}
	if keyAsString, ok := key.(string); ok {
		val, _ := c.Get(keyAsString)
		return val
	}
	return nil
}
290750
func (c *APIContext) Value(key interface{}) interface{} {
	if keyAsString, ok := key.(string); ok {
		val, _ := c.Get(keyAsString)
		return val
	}
	return nil
}
486182
func (d *decodeState) value(v reflect.Value) {
	if !v.IsValid() {
		_, rest, err := NextValue(d.data[d.off:], &d.nextscan)
		if err != nil {
			d.error(err)
		}
		d.off = len(d.data) - len(rest)

		// d.scan thinks we're still at the beginning of the item.
		// Feed in an empty string - the shortest, simplest value -
		// so that it knows we got to the end of the value.
		if d.scan.redo {
			// rewind.
			d.scan.redo = false
			d.scan.Step = stateBeginValue
		}
		d.scan.Step(&d.scan, '"')
		d.scan.Step(&d.scan, '"')

		n := len(d.scan.parseState)
		if n > 0 && d.scan.parseState[n-1] == parseObjectKey {
			// d.scan thinks we just read an object key; finish the object
			d.scan.Step(&d.scan, ':')
			d.scan.Step(&d.scan, '"')
			d.scan.Step(&d.scan, '"')
			d.scan.Step(&d.scan, '}')
		}

		return
	}

	switch op := d.scanWhile(ScanSkipSpace); op {
	default:
		d.error(errPhase)

	case ScanBeginArray:
		d.array(v)

	case ScanBeginObject:
		d.object(v)

	case ScanBeginLiteral:
		d.literal(v)
	}
}
576607
func (setting Setting) Value() (driver.Value, error) {
	result, err := json.Marshal(setting)
	return string(result), err
}
724988
func (d *decodeState) value(v reflect.Value) error {
	switch d.opcode {
	default:
		return errPhase

	case scanBeginArray:
		if v.IsValid() {
			if err := d.array(v); err != nil {
				return err
			}
		} else {
			d.skip()
		}
		d.scanNext()

	case scanBeginObject:
		if v.IsValid() {
			if err := d.object(v); err != nil {
				return err
			}
		} else {
			d.skip()
		}
		d.scanNext()

	case scanBeginLiteral:
		// All bytes inside literal return scanContinue op code.
		start := d.readIndex()
		d.scanWhile(scanContinue)

		if v.IsValid() {
			if err := d.literalStore(d.data[start:d.readIndex()], v, false); err != nil {
				return err
			}
		}
	}
	return nil
}