From 5054d55f80057f7f02f1e68a3e3f939675c20dc7 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Wed, 29 May 2024 11:41:32 +0200 Subject: [PATCH] Restore deleted `DB#BuildColumns()` --- database/db.go | 6 ++++++ 1 file changed, 6 insertions(+) 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(