Because the Logseq client can/will request files it hasn't uploaded yet, the map will contain nil entries for requested files that don't exist
(ctx context.Context, id db.GraphID, fIDs []db.FileID)
| 200 | // Because the Logseq client can/will request files it hasn't uploaded yet, the |
| 201 | // map will contain nil entries for requested files that don't exist |
| 202 | func (d *DB) BatchFileMeta(ctx context.Context, id db.GraphID, fIDs []db.FileID) (map[db.FileID]*db.FileMeta, error) { |
| 203 | fms, err := d.q.BatchFileMetas(ctx, sqlitedb.BatchFileMetasParams{ |
| 204 | GraphID: string(id), |
| 205 | FileIds: convSlice(fIDs, func(id db.FileID) string { return string(id) }), |
| 206 | }) |
| 207 | if err != nil { |
| 208 | return nil, fmt.Errorf("failed to batch load file metadata: %w", err) |
| 209 | } |
| 210 | out := make(map[db.FileID]*db.FileMeta) |
| 211 | for _, fm := range fms { |
| 212 | out[db.FileID(fm.FileID)] = toFileMeta(fm) |
| 213 | } |
| 214 | return out, nil |
| 215 | } |
| 216 | |
| 217 | func toFileMeta(fm sqlitedb.FileMeta) *db.FileMeta { |
| 218 | return &db.FileMeta{ |
nothing calls this directly
no test coverage detected