resizeColUnsafe adjusts the number of columns (must be called with lock held) Fills missing columns with "NaN"
(n int)
| 227 | // resizeColUnsafe adjusts the number of columns (must be called with lock held) |
| 228 | // Fills missing columns with "NaN" |
| 229 | func (b *Buffer) resizeColUnsafe(n int) { |
| 230 | if n <= 0 { |
| 231 | return |
| 232 | } |
| 233 | |
| 234 | lackLen := b.colLen - n |
| 235 | if lackLen < 0 { |
| 236 | lackLen = n - b.colLen |
| 237 | oldColLen := b.colLen |
| 238 | b.colLen = n |
| 239 | |
| 240 | // Resize colType array if needed |
| 241 | if len(b.colType) < n+1 { |
| 242 | newColType := make([]int, n+1) |
| 243 | copy(newColType, b.colType) |
| 244 | b.colType = newColType |
| 245 | } |
| 246 | |
| 247 | // Initialize new column types to colTypeStr (default) |
| 248 | for i := oldColLen; i < n; i++ { |
| 249 | b.colType[i] = colTypeStr |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | // Fill missing columns with NaN |
| 254 | for ii := range b.cont { |
| 255 | for m := 0; m < lackLen; m++ { |
| 256 | b.cont[ii] = append(b.cont[ii], "NaN") |
| 257 | } |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | // resizeCol adjusts the number of columns (thread-safe) |
| 262 | func (b *Buffer) resizeCol(n int) { |
no outgoing calls
no test coverage detected