MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / Get

Method Get

module/upstream/iml.go:66–87  ·  view source on GitHub ↗
(ctx context.Context, pid string)

Source from the content-addressed store, hash-verified

64}
65
66func (i *imlUpstreamModule) Get(ctx context.Context, pid string) (upstream_dto.UpstreamConfig, error) {
67 _, err := i.serviceService.Check(ctx, pid, asServer)
68 if err != nil {
69 return nil, err
70 }
71 _, err = i.upstreamService.Get(ctx, pid)
72 if err != nil {
73 if !errors.Is(err, gorm.ErrRecordNotFound) {
74 return nil, err
75 }
76 return nil, nil
77 }
78 commit, err := i.upstreamService.LatestCommit(ctx, pid, cluster.DefaultClusterID)
79 if err != nil {
80 if !errors.Is(err, gorm.ErrRecordNotFound) {
81 return nil, err
82 }
83 return nil, nil
84 }
85
86 return upstream_dto.FromClusterConfig(commit.Data), nil
87}
88
89func (i *imlUpstreamModule) Save(ctx context.Context, pid string, upstreamConfig upstream_dto.UpstreamConfig) (upstream_dto.UpstreamConfig, error) {
90 pInfo, err := i.serviceService.Check(ctx, pid, asServer)

Callers 1

SaveMethod · 0.95

Calls 3

CheckMethod · 0.65
GetMethod · 0.65
LatestCommitMethod · 0.65

Tested by

no test coverage detected