(ctx context.Context, _ zerolog.Logger, specBytes []byte)
| 88 | } |
| 89 | |
| 90 | func TestConnection(ctx context.Context, _ zerolog.Logger, specBytes []byte) error { |
| 91 | var s Spec |
| 92 | if err := json.Unmarshal(specBytes, &s); err != nil { |
| 93 | return &plugin.TestConnError{ |
| 94 | Code: "INVALID_SPEC", |
| 95 | Message: fmt.Errorf("failed to unmarshal spec: %w", err), |
| 96 | } |
| 97 | } |
| 98 | s.SetDefaults() |
| 99 | |
| 100 | connector, err := duckdb.NewConnector(amendConnectionString(s.ConnectionString), nil) |
| 101 | if err != nil { |
| 102 | return err |
| 103 | } |
| 104 | db := sql.OpenDB(connector) |
| 105 | if err := db.PingContext(ctx); err != nil { |
| 106 | _ = db.Close() |
| 107 | return err |
| 108 | } |
| 109 | |
| 110 | return db.Close() |
| 111 | } |
| 112 | |
| 113 | func (c *Client) exec(ctx context.Context, query string, args ...any) error { |
| 114 | r, err := c.db.ExecContext(ctx, query, args...) |
nothing calls this directly
no test coverage detected