MCPcopy Create free account
hub / github.com/53AI/53AIHub / UpdateGraphTemplate

Function UpdateGraphTemplate

api/service/graph_template.go:107–126  ·  view source on GitHub ↗

UpdateGraphTemplate 更新模板

(ctx context.Context, eid, templateID int64, name, description string,
	logo string, entities []*model.EntityDefinition, relations []*model.RelationDefinition)

Source from the content-addressed store, hash-verified

105
106// UpdateGraphTemplate 更新模板
107func UpdateGraphTemplate(ctx context.Context, eid, templateID int64, name, description string,
108 logo string, entities []*model.EntityDefinition, relations []*model.RelationDefinition) (*model.GraphTemplate, error) {
109
110 // 更新模板
111 template, err := model.UpdateGraphTemplateWithDB(nil, eid, templateID, name, description, logo, entities, relations)
112 if err != nil {
113 // 区分业务错误和系统错误
114 if err.Error() == "template not found" {
115 return nil, ErrTemplateNotFound
116 }
117 if err.Error() == "template name already exists" {
118 return nil, ErrTemplateNameExists
119 }
120 logger.SysError(fmt.Sprintf("Failed to update graph template: %v", err))
121 return nil, err
122 }
123
124 logger.Info(ctx, fmt.Sprintf("Graph template updated successfully, template_id: %d, name: %s", templateID, name))
125 return template, nil
126}
127
128// GetGraphTemplateList 获取模板列表
129func GetGraphTemplateList(ctx context.Context, eid int64, offset, limit int, keyword string) (*GraphTemplateListResponse, error) {

Callers

nothing calls this directly

Calls 2

InfoMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected