Skip to content

Commit

Permalink
Merge pull request #22 from Icinga/restore-build-columns
Browse files Browse the repository at this point in the history
Restore deleted `DB#BuildColumns()`
  • Loading branch information
julianbrost authored Jun 3, 2024
2 parents 2d47d95 + 5054d55 commit c2d7928
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions database/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"golang.org/x/sync/semaphore"
"net"
"net/url"
"slices"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -227,6 +228,11 @@ func (db *DB) GetAddr() string {
return db.addr
}

// BuildColumns returns all columns of the given struct.
func (db *DB) BuildColumns(subject interface{}) []string {
return slices.Clone(db.columnMap.Columns(subject))
}

// BuildDeleteStmt returns a DELETE statement for the given struct.
func (db *DB) BuildDeleteStmt(from interface{}) string {
return fmt.Sprintf(
Expand Down

0 comments on commit c2d7928

Please sign in to comment.