Skip to content

Commit c927d31

Browse files
committed
Remove unused comments, fixed tests and bug with reading Source as name.
1 parent 8f6b05b commit c927d31

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

config/config.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,13 @@ type Database struct {
5252

5353
// Hasura -
5454
type Hasura struct {
55-
URL string `yaml:"url" validate:"required,url"`
56-
Secret string `yaml:"admin_secret" validate:"required"`
57-
RowsLimit uint64 `yaml:"select_limit" validate:"gt=0"`
58-
EnableAggregations bool `yaml:"allow_aggregation"`
59-
AddSource bool `yaml:"add_source"`
60-
//Source string `yaml:"source" validate:"omitempty"`
61-
Source *HasuraSource `yaml:"source" validate:"omitempty"`
62-
Rest *bool `yaml:"rest"`
55+
URL string `yaml:"url" validate:"required,url"`
56+
Secret string `yaml:"admin_secret" validate:"required"`
57+
RowsLimit uint64 `yaml:"select_limit" validate:"gt=0"`
58+
EnableAggregations bool `yaml:"allow_aggregation"`
59+
AddSource bool `yaml:"add_source"`
60+
Source *HasuraSource `yaml:"source" validate:"omitempty"`
61+
Rest *bool `yaml:"rest"`
6362
}
6463

6564
type HasuraSource struct {

hasura/hasura.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func Create(ctx context.Context, args GenerateArgs) error {
9191
}
9292
}
9393
if selectedSource == nil {
94-
return errors.Errorf("Source '%s' not found on exported metadata", args.Config.Source)
94+
return errors.Errorf("Source '%s' not found on exported metadata", args.Config.Source.Name)
9595
}
9696

9797
log.Info().Msg("Merging metadata...")

hasura/hasura_test.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ func TestGenerate(t *testing.T) {
142142
hasura: config.Hasura{
143143
EnableAggregations: true,
144144
RowsLimit: 5,
145-
Source: "mysql",
145+
Source: &config.HasuraSource{
146+
Name: "mysql",
147+
UsePreparedStatements: true,
148+
IsolationLevel: "read-committed",
149+
},
146150
},
147151
models: []interface{}{
148152
&testTable{}, &testTable2{}, &testTable3{}, &testTable4{},

0 commit comments

Comments
 (0)