diff --git a/database/db.go b/database/db.go index 3eb2df76..d024e421 100644 --- a/database/db.go +++ b/database/db.go @@ -22,6 +22,7 @@ import ( "golang.org/x/sync/semaphore" "net" "net/url" + "slices" "strconv" "strings" "sync" @@ -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(