getBlocksBetween fetches blocks with IDs [start, end] for a given inode and returns a list of blockInfo objects.
(e sqlExecutor, inodeID uint64, start, end int)
| 128 | // getBlocksBetween fetches blocks with IDs [start, end] for a given inode |
| 129 | // and returns a list of blockInfo objects. |
| 130 | func getBlocksBetween(e sqlExecutor, inodeID uint64, start, end int) ([]blockInfo, error) { |
| 131 | stmt := `SELECT block, data FROM fs_block WHERE id = ? AND block >= ? AND block <= ?` |
| 132 | rows, err := e.Query(stmt, inodeID, start, end) |
| 133 | if err != nil { |
| 134 | return nil, err |
| 135 | } |
| 136 | return buildBlockInfos(rows) |
| 137 | } |
| 138 | |
| 139 | func buildBlockInfos(rows *sql.Rows) ([]blockInfo, error) { |
| 140 | var results []blockInfo |
no test coverage detected