MCPcopy Create free account
hub / github.com/bcspragu/logseq-sync / CreateGraph

Method CreateGraph

db/sqlite/sqlite.go:98–108  ·  view source on GitHub ↗
(ctx context.Context, name string)

Source from the content-addressed store, hash-verified

96 return convSlice(gs, toGraph), nil
97}
98func (d *DB) CreateGraph(ctx context.Context, name string) (db.GraphID, db.Tx, error) {
99 id := uuid.NewString()
100 tx, err := d.q.CreateGraph(ctx, sqlitedb.CreateGraphParams{
101 ID: id,
102 Name: name,
103 })
104 if err != nil {
105 return "", 0, fmt.Errorf("failed to create graph: %w", err)
106 }
107 return db.GraphID(id), db.Tx(tx), nil
108}
109
110func (d *DB) DeleteGraph(ctx context.Context, id db.GraphID) error {
111 if err := d.q.DeleteGraph(ctx, string(id)); errors.Is(err, sql.ErrNoRows) {

Callers

nothing calls this directly

Implementers 2

DBdb/mem/mem.go
DBdb/sqlite/sqlite.go

Calls 3

GraphIDTypeAlias · 0.92
TxTypeAlias · 0.92
CreateGraphMethod · 0.65

Tested by

no test coverage detected