MCPcopy Create free account
hub / github.com/donatj/sqlread / ReadAt

Method ReadAt

cmd/sqlread/stdinwrap.go:21–43  ·  view source on GitHub ↗
(b []byte, off int64)

Source from the content-addressed store, hash-verified

19}
20
21func (s *StdinWrap) ReadAt(b []byte, off int64) (int, error) {
22 e := off + int64(len(b)) - 1
23
24 for e+1 > s.end {
25 b2 := make([]byte, e-s.end+1)
26 n, err := s.stdin.Read(b2)
27 if err != nil {
28 return 0, err // n value here is questionable
29 }
30
31 s.end += int64(n)
32
33 s.data = append(s.data, b2[:n]...)
34 }
35
36 i := 0
37 for a := off; a <= e; a++ {
38 b[i] = s.data[a]
39 i++
40 }
41
42 return len(b), nil
43}
44
45func (s *StdinWrap) Flush() {
46 for {

Callers 3

peekMethod · 0.45
emitMethod · 0.45
showCreateTableFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected