github.com/cayleygraph/cayley@v0.7.7/quad/rw.go (about) 1 package quad 2 3 import ( 4 "github.com/cayleygraph/quad" 5 ) 6 7 // Writer is a minimal interface for quad writers. Used for quad serializers and quad stores. 8 // 9 // Deprecated: use github.com/cayleygraph/quad package instead. 10 type Writer = quad.Writer 11 12 type WriteCloser = quad.WriteCloser 13 14 // BatchWriter is an interface for writing quads in batches. 15 // 16 // Deprecated: use github.com/cayleygraph/quad package instead. 17 type BatchWriter = quad.BatchWriter 18 19 // Reader is a minimal interface for quad readers. Used for quad deserializers and quad iterators. 20 // 21 // ReadQuad reads next valid Quad. It returns io.EOF if no quads are left. 22 // 23 // Deprecated: use github.com/cayleygraph/quad package instead. 24 type Reader = quad.Reader 25 26 // Skipper is an interface for quad reader that can skip quads efficiently without decoding them. 27 // 28 // It returns io.EOF if no quads are left. 29 // 30 // Deprecated: use github.com/cayleygraph/quad package instead. 31 type Skipper = quad.Skipper 32 33 type ReadCloser = quad.ReadCloser 34 35 type ReadSkipCloser = quad.ReadSkipCloser 36 37 // BatchReader is an interface for reading quads in batches. 38 // 39 // ReadQuads reads at most len(buf) quads into buf. It returns number of quads that were read and an error. 40 // It returns an io.EOF if there is no more quads to read. 41 // 42 // Deprecated: use github.com/cayleygraph/quad package instead. 43 type BatchReader = quad.BatchReader 44 45 type Quads = quad.Quads 46 47 // NewReader creates a quad reader from a quad slice. 48 // 49 // Deprecated: use github.com/cayleygraph/quad package instead. 50 func NewReader(quads []Quad) *Quads { 51 return quad.NewReader(quads) 52 } 53 54 // Copy will copy all quads from src to dst. It returns copied quads count and an error, if it failed. 55 // 56 // Copy will try to cast dst to BatchWriter and will switch to CopyBatch implementation in case of success. 57 // 58 // Deprecated: use github.com/cayleygraph/quad package instead. 59 func Copy(dst Writer, src Reader) (n int, err error) { 60 return quad.Copy(dst, src) 61 } 62 63 var DefaultBatch = quad.DefaultBatch 64 65 // CopyBatch will copy all quads from src to dst in a batches of batchSize. 66 // It returns copied quads count and an error, if it failed. 67 // 68 // If batchSize <= 0 default batch size will be used. 69 // 70 // Deprecated: use github.com/cayleygraph/quad package instead. 71 func CopyBatch(dst BatchWriter, src Reader, batchSize int) (int, error) { 72 return quad.CopyBatch(dst, src, batchSize) 73 } 74 75 // ReadAll reads all quads from r until EOF. 76 // It returns a slice with all quads that were read and an error, if any. 77 // 78 // Deprecated: use github.com/cayleygraph/quad package instead. 79 func ReadAll(r Reader) ([]Quad, error) { 80 return quad.ReadAll(r) 81 } 82 83 // IRIOptions is a set of option 84 // 85 // Deprecated: use github.com/cayleygraph/quad package instead. 86 type IRIOptions = quad.IRIOptions 87 88 // IRIWriter is a writer implementation that converts all IRI values in quads 89 // according to the IRIOptions. 90 // 91 // Deprecated: use github.com/cayleygraph/quad package instead. 92 func IRIWriter(w Writer, opt IRIOptions) Writer { 93 return quad.IRIWriter(w, opt) 94 } 95 96 // ValuesWriter is a writer implementation that converts all quad values using the callback function. 97 // 98 // Deprecated: use github.com/cayleygraph/quad package instead. 99 func ValuesWriter(w Writer, fnc func(d Direction, v Value) (Value, error)) Writer { 100 return quad.ValuesWriter(w, fnc) 101 }