Skip to content

Commit eb9dce5

Browse files
committed
✨ Add support for MySQL-based databases
And fix a couple of issues discovered with the PostgreSQL modules while developing the MySQL modules The namespace can now import remote database tables at startup
1 parent 9d01809 commit eb9dce5

File tree

6 files changed

+1117
-32
lines changed

6 files changed

+1117
-32
lines changed

controller/connection.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func ConnectionAdd(cmd *cobra.Command, args []string) error {
122122
} else {
123123
fields = append(fields, huh.NewInput().
124124
Title("Connection string (URL)").
125-
Description("The connection string to the database. For example, for MySQL, it's mysql://user:password@localhost:3306/dbname").
125+
Description("The connection string to the database. For example, for MySQL, it's 'username:password@tcp(host:1234)/database'").
126126
Validate(validateConnectionURL).
127127
Value(&connectionString))
128128
}
@@ -133,7 +133,8 @@ func ConnectionAdd(cmd *cobra.Command, args []string) error {
133133
Title("Filter (cel expression)").
134134
Placeholder("true").
135135
ShowLineNumbers(true).
136-
Description("A CEL expression to filter the tables to import. For example, 'table.name IN ['table1', 'table2']'\nLeave \"true\" to import all tables.").
136+
Description("A CEL expression to filter the tables to import. For example, table.name in ['table1', 'table2''\nLeave \"true\" to import all tables.\n"+
137+
"Refer to https://anyquery.dev/docs/database/cel-script/ for more information").
137138
Value(&filter))
138139
}
139140

@@ -142,7 +143,7 @@ func ConnectionAdd(cmd *cobra.Command, args []string) error {
142143
if !isSTDinAtty() || !isSTDoutAtty() {
143144
return fmt.Errorf("interactive mode is required to add a connection. Otherwise, provide the connection name, type, connection string, and filter as arguments")
144145
}
145-
grp := huh.NewGroup(fields...)
146+
grp := huh.NewGroup(fields...).Title("Connection information").Description("Let's add a new database connection to Anyquery")
146147
err := huh.NewForm(grp).Run()
147148
if err != nil {
148149
return fmt.Errorf("could not ask for the connection information: %w", err)

module/db_helper.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ type databaseColumn struct {
1010
Realname string
1111
// The name of the column locally
1212
SQLiteName string
13-
// The type of the column
13+
// The type of the column in SQLite
1414
Type string
15+
// The type of the column in the remote database
16+
RemoteType string
1517
// Whether the column is supported. If not, it's not queryable, insertable, or updatable
1618
Supported bool
1719
// DefaultValue value for the column

0 commit comments

Comments
 (0)