示例#1
0
func (c Crossref) Iterate(r io.Reader) (<-chan []span.Importer, error) {
	return span.FromLines(r, func(b []byte) (span.Importer, error) {
		doc := new(Document)
		err := json.Unmarshal(b, doc)
		if err != nil {
			log.Printf("%s", string(b))
		}
		return doc, err
	})
}
示例#2
0
func (s DOAJ) Iterate(r io.Reader) (<-chan []span.Importer, error) {
	return span.FromLines(r, func(b []byte) (span.Importer, error) {
		resp := new(Response)
		err := json.Unmarshal(b, resp)
		if err != nil {
			return resp.Source, err
		}
		resp.Source.Type = resp.Type
		return resp.Source, nil
	})
}