MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / GetApiById

Method GetApiById

internal/repository/api.go:40–49  ·  view source on GitHub ↗

GetApiById 根据ID获取API

(ctx context.Context, id int)

Source from the content-addressed store, hash-verified

38
39// GetApiById 根据ID获取API
40func (a *apiRepository) GetApiById(ctx context.Context, id int) (*domain.Api, error) {
41 if id <= 0 {
42 return nil, dao.ErrInvalidMenu // 添加ID有效性检查
43 }
44 api, err := a.dao.GetApiById(ctx, id)
45 if err != nil {
46 return nil, err
47 }
48 return a.apiFromDAO(api), nil
49}
50
51// UpdateApi 更新API信息
52func (a *apiRepository) UpdateApi(ctx context.Context, api *domain.Api) error {

Callers

nothing calls this directly

Calls 2

apiFromDAOMethod · 0.95
GetApiByIdMethod · 0.65

Tested by

no test coverage detected