NewQueryLogger opens a dedicated :memory: DuckDB, attaches DuckLake, creates the system.query_log table, and starts the background flush goroutine.
(cfg Config)
| 110 | // close it to unblock shutdown. |
| 111 | func (ql *QueryLogger) StopContext(ctx context.Context) error { |
| 112 | if ql == nil { |
| 113 | return nil |
| 114 | } |
| 115 | if ctx == nil { |
| 116 | ctx = context.Background() |
| 117 | } |
| 118 | var stopErr error |
| 119 | ql.stopOnce.Do(func() { |
| 120 | if ql.ch != nil { |
| 121 | close(ql.ch) |
| 122 | } |
| 123 | if ql.done != nil { |
| 124 | select { |
| 125 | case <-ql.done: |
| 126 | case <-ctx.Done(): |
| 127 | stopErr = ctx.Err() |
| 128 | if ql.cancel != nil { |
| 129 | ql.cancel() |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | if ql.cancel != nil { |
| 134 | ql.cancel() |
| 135 | } |
| 136 | if ql.db != nil && ql.closeDB { |
no test coverage detected