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

Method Get

module/log/iml.go:161–184  ·  view source on GitHub ↗
(ctx context.Context, driver string)

Source from the content-addressed store, hash-verified

159}
160
161func (i *imlLogModule) Get(ctx context.Context, driver string) (*log_dto.LogSource, error) {
162 info, err := i.service.GetLogSource(ctx, driver)
163 if err != nil {
164 if !errors.Is(err, gorm.ErrRecordNotFound) {
165 return nil, err
166 }
167 return nil, nil
168 }
169 cfg := make(map[string]interface{})
170 if info.Config != "" {
171 err = json.Unmarshal([]byte(info.Config), &cfg)
172 if err != nil {
173 return nil, err
174 }
175 }
176 return &log_dto.LogSource{
177 ID: info.ID,
178 Config: cfg,
179 Creator: auto.UUID(info.Creator),
180 Updater: auto.UUID(info.Updater),
181 CreateAt: auto.TimeLabel(info.CreateAt),
182 UpdateAt: auto.TimeLabel(info.UpdateAt),
183 }, nil
184}
185
186func (i *imlLogModule) OnInit() {
187 register.Handle(func(v server.Server) {

Callers

nothing calls this directly

Calls 1

GetLogSourceMethod · 0.65

Tested by

no test coverage detected