()
| 327 | } |
| 328 | |
| 329 | func (d *dependency) DBClient() *ent.Client { |
| 330 | if d.dbClient != nil { |
| 331 | return d.dbClient |
| 332 | } |
| 333 | |
| 334 | if d.rawEntClient == nil { |
| 335 | client, err := inventory.NewRawEntClient(d.Logger(), d.ConfigProvider()) |
| 336 | if err != nil { |
| 337 | d.panicError(err) |
| 338 | } |
| 339 | |
| 340 | d.rawEntClient = client |
| 341 | } |
| 342 | |
| 343 | proSuffix := "" |
| 344 | if d.isPro { |
| 345 | proSuffix = "-pro" |
| 346 | } |
| 347 | |
| 348 | client, err := inventory.InitializeDBClient(d.Logger(), d.rawEntClient, d.KV(), d.requiredDbVersion+proSuffix) |
| 349 | if err != nil { |
| 350 | d.panicError(err) |
| 351 | } |
| 352 | |
| 353 | d.dbClient = client |
| 354 | return d.dbClient |
| 355 | } |
| 356 | |
| 357 | func (d *dependency) KV() cache.Driver { |
| 358 | if d.kv != nil { |
no test coverage detected