(_ context.Context, name string)
| 47 | } |
| 48 | |
| 49 | func (d *DB) CreateGraph(_ context.Context, name string) (db.GraphID, db.Tx, error) { |
| 50 | for _, g := range d.graphs { |
| 51 | if name == g.graph.Name { |
| 52 | return "", 0, db.AlreadyExists("graph", "name") |
| 53 | } |
| 54 | } |
| 55 | id := db.GraphID(uuid.NewString()) |
| 56 | tx := db.Tx(0) |
| 57 | d.graphs[id] = &graph{ |
| 58 | graph: &db.Graph{ |
| 59 | ID: id, |
| 60 | Name: name, |
| 61 | }, |
| 62 | salts: []*db.GraphSalt{}, |
| 63 | keys: []*db.GraphEncryptKey{}, |
| 64 | metas: make(map[db.FileID][]*db.FileMeta), |
| 65 | tx: tx, |
| 66 | } |
| 67 | return id, tx, nil |
| 68 | } |
| 69 | |
| 70 | func (d *DB) Graphs(_ context.Context) ([]*db.Graph, error) { |
| 71 | var out []*db.Graph |
nothing calls this directly
no test coverage detected