modelRT/diagram/topologic_set.go

22 lines
367 B
Go
Raw Normal View History

package diagram
import (
"errors"
"fmt"
"sync"
)
var GraphOverview sync.Map
func GetGraphMap(key string) (*Graph, error) {
value, ok := GraphOverview.Load(key)
if !ok {
return nil, fmt.Errorf("can not find graph by pageID:%s", key)
}
graph, ok := value.(*Graph)
if !ok {
return nil, errors.New("convert to graph struct failed")
}
return graph, nil
}