go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/sdk/db/dbgen/utils.go (about) 1 /* 2 3 Copyright (c) 2023 - Present. Will Charczuk. All rights reserved. 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository. 5 6 */ 7 8 package dbgen 9 10 import ( 11 "fmt" 12 13 "go.charczuk.com/sdk/db" 14 ) 15 16 func mustHaveColumn(obj any, col string) { 17 if !hasColumn(obj, col) { 18 panic(fmt.Sprintf("object %T does not have a column with name %q", obj, col)) 19 } 20 } 21 22 func hasColumn(obj any, col string) bool { 23 return db.TypeMetaFor(obj).HasColumn(col) 24 }