/** @author: yaoyuliang @date: 2023/3/9 **/ package utils import ( "database/sql" "fmt" "strings" ) func CheckColumn(db *sql.DB, table, columnName, chainCode string) (int, error) { var check int err := db.QueryRow(fmt.Sprintf(` select count(0) from information_schema.columns where table_name = '%s' and column_name = '%s' AND table_schema = '%s' `, table, columnName, "dbc_"+strings.ToLower(chainCode))).Scan(&check) if err != nil { return check, err } return check, nil }