(ctx context.Context, id db.GraphID)
| 64 | } |
| 65 | |
| 66 | func (d *DB) Graph(ctx context.Context, id db.GraphID) (*db.Graph, error) { |
| 67 | g, err := d.q.Graph(ctx, string(id)) |
| 68 | if errors.Is(err, sql.ErrNoRows) { |
| 69 | return nil, db.NotExists("graph", id) |
| 70 | } else if err != nil { |
| 71 | return nil, fmt.Errorf("failed to load graph: %w", err) |
| 72 | } |
| 73 | return toGraph(g), nil |
| 74 | } |
| 75 | |
| 76 | func toGraph(g sqlitedb.Graph) *db.Graph { |
| 77 | return &db.Graph{ |