MCPcopy Create free account
hub / github.com/cloudquery/cloudquery / isColumnUnique

Method isColumnUnique

plugins/destination/duckdb/client/migrate.go:221–241  ·  view source on GitHub ↗
(ctx context.Context, tableName string, columName string)

Source from the content-addressed store, hash-verified

219}
220
221func (c *Client) isColumnUnique(ctx context.Context, tableName string, columName string) (bool, error) {
222 rows, err := c.db.QueryContext(ctx, isColumnUniqueSQL, tableName, columName)
223 if err != nil {
224 return false, err
225 }
226 defer rows.Close()
227 for rows.Next() {
228 var n int
229 if err := rows.Scan(&n); err != nil {
230 return false, err
231 }
232 if n == 1 {
233 return true, nil
234 }
235 }
236 if err := rows.Err(); err != nil {
237 return false, err
238 }
239
240 return false, nil
241}
242
243func (c *Client) getTableInfo(ctx context.Context, tableName string) (*schema.Table, error) {
244 info := tableInfo{}

Callers 1

getTableInfoMethod · 0.95

Calls 3

NextMethod · 0.80
ScanMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected