// Record implements pdk.Record returning a map[string]interface{} for each json
// object in the source files.
357210
func (s *Source) Record() (interface{}, error) {
	rec, ok := <-s.records
	if !ok {
		return nil, io.EOF
	}
	return rec.data, rec.err
}
413426
func EncodeLDJSON(w io.Writer, i *Iterator) error {
	r := make(Record)

	enc := json.NewEncoder(w)

	for i.Next() {
		if err := i.Scan(r); err != nil {
			return err
		}

		if err := enc.Encode(r); err != nil {
			return err
		}
	}

	return nil
}
1090715
func (s *CombinedMapSlice) UpsertRecorded(key MergeKeys, l interface{}) error {
	item, err := s.upsert(key, l)
	if err != nil {
		return err
	}
	item.SetRecorded(l)
	return nil
}
76772
func (w *Writer) Write(record interface{}) error {
	m, ok := record.(map[string]string)
	if ok {
		return w.writeMapString(m)
	}
	return w.writeAny(reflect.ValueOf(record))
}
1260869
func (t *Trace) Record(name string, tags map[string]string) error {
	return t.ClientRecord(DefaultClient, name, tags)
}
328885
func (self *Record) List(zoneId, version int64) ([]*RecordInfo, error) {
	opts := &struct {
		Page int `xmlrpc:"page"`
	}{0}
	const perPage = 100
	params := []interface{}{self.Key, zoneId, version, opts}
	records := make([]*RecordInfo, 0)
	for {
		var res []interface{}
		if err := self.Call("domain.zone.record.list", params, &res); err != nil {
			return nil, err
		}
		for _, r := range res {
			record := ToRecordInfo(r.(map[string]interface{}))
			records = append(records, record)
		}
		if len(res) < perPage {
			break
		}
		opts.Page++
	}
	return records, nil
}
824854
func (m *MDNSService) Records(q dns.Question) []dns.RR {
	switch q.Name {
	case m.enumAddr:
		return m.serviceEnum(q)
	case m.serviceAddr:
		return m.serviceRecords(q)
	case m.instanceAddr:
		return m.instanceRecords(q)
	case m.HostName:
		if q.Qtype == dns.TypeA || q.Qtype == dns.TypeAAAA {
			return m.instanceRecords(q)
		}
		fallthrough
	default:
		return nil
	}
}
265479
func (r *Record) Get(key string) (value interface{}, err error) {
	value, ok := r.Data[key]
	if !ok {
		value = ""
	}
	return
}
217478
func EncodeRecordKey(recordPrefix kv.Key, h int64) kv.Key {
	buf := make([]byte, 0, len(recordPrefix)+idLen)
	buf = append(buf, recordPrefix...)
	buf = codec.EncodeInt(buf, h)
	return buf
}
1167019
func (e *Etcd) Records(state request.Request, exact bool) ([]msg.Service, error) {
	name := state.Name()

	path, star := msg.PathWithWildcard(name, e.PathPrefix)
	r, err := e.get(path, true)
	if err != nil {
		return nil, err
	}
	segments := strings.Split(msg.Path(name, e.PathPrefix), "/")
	switch {
	case exact && r.Node.Dir:
		return nil, nil
	case r.Node.Dir:
		return e.loopNodes(r.Node.Nodes, segments, star, nil)
	default:
		return e.loopNodes([]*etcdc.Node{r.Node}, segments, false, nil)
	}
}
1002723
func NewRecord(key string, value interface{}) Record {
	return Record{
		Key:   key,
		Value: value,
	}
}
1118899
func (s *Source) Record() (interface{}, error) {
	if s.MaxMsgs > 0 {
		s.numMsgs++
		if s.numMsgs > s.MaxMsgs {
			return nil, io.EOF
		}
	}
	msg, ok := <-s.consumer.Messages()
	if ok {
		var ret interface{}
		switch s.Type {
		case "json":
			parsed := make(map[string]interface{})
			err := json.Unmarshal(msg.Value, &parsed)
			if err != nil {
				return nil, errors.Wrap(err, "unmarshaling json")
			}
			ret = parsed
		case "raw":
			ret = msg
		default:
			return nil, errors.Errorf("unsupported kafka message type: '%v'", s.Type)
		}
		s.consumer.MarkOffset(msg, "") // mark message as processed
		return ret, nil
	}
	return nil, errors.New("messages channel closed")
}
1099098
func (records *Records) Create(ctx context.Context, record *Record) (err error) {
	buffer := new(bytes.Buffer)
	err = json.NewEncoder(buffer).Encode(record)
	if err != nil {
		return
	}
	response, err := httpDo(ctx, records.Options, "POST", apiURL("/zones/%s/dns_records", record.ZoneID), buffer)
	if err != nil {
		return
	}
	defer response.Body.Close()
	result, err := readResponse(response.Body)
	if err != nil {
		return
	}
	res := new(Record)
	err = json.Unmarshal(result.Result, &res)
	if err != nil {
		return
	}
	record.ID = res.ID
	record.TTL = res.TTL
	record.Locked = res.Locked
	record.Proxied = res.Proxied
	record.Proxiable = res.Proxiable
	record.CreatedOn = res.CreatedOn
	record.ModifiedOn = res.ModifiedOn
	return
}
85785
func MakeRecord(data map[string]interface{}) (record *Record, err error) {
	recordID, ok := data["_id"].(string)
	if !ok {
		return nil, fmt.Errorf("Record data not in expected format: '_id' is not string.")
	}
	// Remove the id from the Data map: it is now stored in RecordID
	delete(data, "_id")

	record = &Record{
		RecordID: recordID,
		Data:     data,
	}

	return record, nil
}
1000924
func (t *tableCommon) RecordKey(h int64) kv.Key {
	return tablecodec.EncodeRecordKey(t.recordPrefix, h)
}
1029722
func (s *ConfluentSource) Record() (interface{}, error) {
	rec, err := s.Source.Record()
	if err != nil {
		return rec, err
	}
	msg, ok := rec.(*sarama.ConsumerMessage)
	if !ok {
		return rec, errors.Errorf("record is not a raw kafka record, but a %T", rec)
	}
	val := msg.Value
	return s.decodeAvroValueWithSchemaRegistry(val)
}
589627
func (j *JsonQuery) Object(s ...string) (map[string]interface{}, error) {
	val, err := rquery(j.blob, s...)
	if err != nil {
		return map[string]interface{}{}, err
	}
	return objectFromInterface(val)
}