-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* "Remote Connection" button and model * share link is in working state * works with separate account * request works unauth * add home router * start of adding other destinations * add template * connection save message * typo * support different destination * start of adding other destinations * add template * support different destination * destination is immediately created * start of adding other destinations * add template * support different destination * start of adding other destinations * support different destination * requested changes * start of adding other destinations * add template * support different destination * start of adding other destinations * support different destination * start of adding other destinations * add template * start of adding other destinations * support different destination * add textarea type * auto-parse form * changes --------- Co-authored-by: poundifdef <jay@scratchdata.com>
- Loading branch information
1 parent
415c97b
commit 18cdcf2
Showing
12 changed files
with
327 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package destinations | ||
|
||
import ( | ||
"github.com/scratchdata/scratchdata/pkg/destinations/bigquery" | ||
"github.com/scratchdata/scratchdata/pkg/destinations/clickhouse" | ||
"github.com/scratchdata/scratchdata/pkg/destinations/duckdb" | ||
"github.com/scratchdata/scratchdata/pkg/destinations/redshift" | ||
) | ||
|
||
var ViewConfig = map[string]struct { | ||
Type any | ||
Display string | ||
}{ | ||
"duckdb": { | ||
Type: duckdb.DuckDBServer{}, | ||
Display: "DuckDB", | ||
}, | ||
"redshift": { | ||
Type: redshift.RedshiftServer{}, | ||
Display: "Redshift", | ||
}, | ||
"bigquery": { | ||
Type: bigquery.BigQueryServer{}, | ||
Display: "BigQuery", | ||
}, | ||
"clickhouse": { | ||
Type: clickhouse.ClickhouseServer{}, | ||
Display: "Clickhouse", | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package util | ||
|
||
import ( | ||
"reflect" | ||
"strings" | ||
) | ||
|
||
type Form struct { | ||
Name string | ||
Type string | ||
Label string | ||
Default string | ||
} | ||
|
||
// TODO breadchris return error if form tag is malformed | ||
func ConvertToForms(server any) []Form { | ||
var forms []Form | ||
|
||
serverValue := reflect.ValueOf(server) | ||
serverType := serverValue.Type() | ||
|
||
for i := 0; i < serverValue.NumField(); i++ { | ||
fieldType := serverType.Field(i) | ||
|
||
form := fieldType.Tag.Get("form") | ||
schema := fieldType.Tag.Get("schema") | ||
|
||
parts := strings.Split(schema, ",") | ||
schemaName := parts[0] | ||
|
||
parts = strings.Split(form, ",") | ||
formLabel := "" | ||
formDefault := "" | ||
formType := "" | ||
for _, part := range parts { | ||
if strings.HasPrefix(part, "label:") { | ||
formLabel = strings.TrimPrefix(part, "label:") | ||
} | ||
if strings.HasPrefix(part, "default:") { | ||
formDefault = strings.TrimPrefix(part, "default:") | ||
} | ||
if strings.HasPrefix(part, "type:") { | ||
formType = strings.TrimPrefix(part, "type:") | ||
} | ||
} | ||
|
||
if formType != "" { | ||
forms = append(forms, Form{ | ||
Name: schemaName, | ||
Type: formType, | ||
Label: formLabel, | ||
Default: formDefault, | ||
}) | ||
} | ||
} | ||
return forms | ||
} |
Oops, something went wrong.