-
Notifications
You must be signed in to change notification settings - Fork 13
Description
The current method for getting a table columns looks like this:
func Columns(ctx context.Context, table string) ([]string, error)
This is not complete since the columns may depend of a schema (e.g. there can be a table foo in two schemas public and bar). But some SQL data sources doesn't have the concept of schema and forcing it may not be the best option.
Also, we have an example of a data source that the table / column resolution depends on other parameters (not SQL related). This SQL data source is a database as a service, so it also depends on the database name and the region. To satisfy this for the moment, we have added a new endpoint /columns-with-details but that's just a workaround IMO.
To satisfy all the different data sources, we will need flexible argument(s) to set the different parameters. If we agree to that we have several options for the function signature:
func Columns(ctx context.Context, options map[string]string) ([]string, error)func Columns(ctx context.Context, options ...string) ([]string, error)func Columns(ctx context.Context, options interface{}) ([]string, error)
I would go with the second since it better reflect the variadic nature of the function and all the parameters we foresee are strings. Opinions?
Note that this would be a breaking change.