Skip to content

Commit c2d7928

Browse files
authored
Merge pull request #22 from Icinga/restore-build-columns
Restore deleted `DB#BuildColumns()`
2 parents 2d47d95 + 5054d55 commit c2d7928

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

database/db.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"golang.org/x/sync/semaphore"
2323
"net"
2424
"net/url"
25+
"slices"
2526
"strconv"
2627
"strings"
2728
"sync"
@@ -227,6 +228,11 @@ func (db *DB) GetAddr() string {
227228
return db.addr
228229
}
229230

231+
// BuildColumns returns all columns of the given struct.
232+
func (db *DB) BuildColumns(subject interface{}) []string {
233+
return slices.Clone(db.columnMap.Columns(subject))
234+
}
235+
230236
// BuildDeleteStmt returns a DELETE statement for the given struct.
231237
func (db *DB) BuildDeleteStmt(from interface{}) string {
232238
return fmt.Sprintf(

0 commit comments

Comments
 (0)