TMP: codetables
Some checks failed
CI / build-docker (push) Successful in 4s
CI / build-docker-bootstrap (push) Has been skipped
CI / release-test (push) Failing after 6s

This commit is contained in:
2026-03-19 23:36:51 -07:00
committed by ~wispem-wantex
parent 4f3865deaa
commit 83a7087a3b
8 changed files with 208 additions and 3 deletions

View File

@@ -1,7 +1,12 @@
package schema
import (
"fmt"
"slices"
"sort"
"git.offline-twitter.com/offline-labs/gas-stack/pkg/flowutils"
"github.com/jmoiron/sqlx"
)
// Table is a single SQLite table.
@@ -61,3 +66,11 @@ func (t Table) HasAutoTimestamps() (hasCreatedAt bool, hasUpdatedAt bool) {
}
return
}
func (t Table) GetCodeTableValues(db *sqlx.DB) (ret []string) {
if !slices.ContainsFunc(t.Columns, func(c Column) bool { return c.Name == "name" }) {
panic("not a code table")
}
flowutils.PanicIf(db.Select(&ret, fmt.Sprintf("select name from %s", t.TableName)))
return
}