(ctx context.Context, driver string)
| 159 | } |
| 160 | |
| 161 | func (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 | |
| 186 | func (i *imlLogModule) OnInit() { |
| 187 | register.Handle(func(v server.Server) { |
nothing calls this directly
no test coverage detected