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

Method createGraph

cmd/server/main.go:512–525  ·  view source on GitHub ↗
(ctx context.Context, req *createGraphRequest)

Source from the content-addressed store, hash-verified

510}
511
512func (s *server) createGraph(ctx context.Context, req *createGraphRequest) (*createGraphResponse, error) {
513 gID, curTx, err := s.db.CreateGraph(ctx, req.GraphName)
514 if db.IsAlreadyExists(err) {
515 return nil, httperr.
516 Conflict("graph already exists: %w", err).
517 WithMessage("a graph with that name already exists")
518 } else if err != nil {
519 return nil, httperr.Internal("failed to create graph: %w", err)
520 }
521 return &createGraphResponse{
522 GraphUUID: string(gID),
523 Txid: int64(curTx),
524 }, nil
525}
526
527type deleteGraphRequest struct {
528 GraphUUID string `json:"GraphUUID"`

Callers

nothing calls this directly

Calls 5

IsAlreadyExistsFunction · 0.92
ConflictFunction · 0.92
InternalFunction · 0.92
WithMessageMethod · 0.80
CreateGraphMethod · 0.65

Tested by

no test coverage detected