Skip to content

Commit 566958a

Browse files
committed
implement code generation
1 parent 78b05a3 commit 566958a

File tree

359 files changed

+2781
-9163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

359 files changed

+2781
-9163
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ go.work
2525
.env
2626
.idea
2727
**/.xatarc
28+
**/fern.config.json
2829

2930
# ignore license header checker
3031
bin/license-header-checker

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ smoke-test: ## smoke tests
1010
@echo "Running test app for sanity check"
1111
@cd internal/smoke-tests && go run . && cd ../..
1212

13-
test: ## run all tests
13+
test: ## run unit tests
1414
@echo "Running unit tests"
1515
@go test -v -count=1 -cover -race ./xata
1616

@@ -33,3 +33,11 @@ check-license-header: ## Check if all *.py files have a license header
3333
help: ## Display help
3434
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
3535
#------------- <https://suva.sh/posts/well-documented-makefiles> --------------
36+
37+
.PHONY: generate-core-code
38+
generate-core-code:
39+
go run xata/internal/code-gen/code_gen.go -scope=core
40+
41+
.PHONY: generate-workspace-code
42+
generate-workspace-code:
43+
go run xata/internal/code-gen/code_gen.go -scope=workspace

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ require (
77
github.com/hashicorp/go-retryablehttp v0.7.4
88
github.com/joho/godotenv v1.5.1
99
github.com/stretchr/testify v1.8.4
10+
gopkg.in/yaml.v2 v2.4.0
11+
gopkg.in/yaml.v3 v3.0.1
1012
)
1113

1214
require (
1315
github.com/davecgh/go-spew v1.1.1 // indirect
1416
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
1517
github.com/pmezard/go-difflib v1.0.0 // indirect
16-
gopkg.in/yaml.v3 v3.0.1 // indirect
1718
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
1717
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
1818
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
1919
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
20+
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
21+
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
2022
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
2123
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

internal/docs/sql-openapi.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

internal/docs/workspace-openapi.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

internal/integration-tests/search_filter_client_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ func Test_searchAndFilterClient(t *testing.T) {
563563
assert.NoError(t, err)
564564
if (*aggTableRes.Aggs)["histogram"] != nil &&
565565
(*aggTableRes.Aggs)["histogram"].AggResponseValues != nil {
566-
return len((*aggTableRes.Aggs)["histogram"].AggResponseValues.Values) > 0
566+
return len((*aggTableRes.Aggs)["histogram"].AggResponseValues.Values.AggResponseValuesValuesItemList) > 0
567567
}
568568
return false
569569
}, time.Second*10, time.Second)
@@ -589,7 +589,7 @@ func Test_searchAndFilterClient(t *testing.T) {
589589
})
590590
assert.NoError(t, err)
591591
if (*aggTableRes.Aggs)["histogram"] != nil && (*aggTableRes.Aggs)["histogram"].AggResponseValues != nil {
592-
return len((*aggTableRes.Aggs)["histogram"].AggResponseValues.Values) > 0
592+
return len((*aggTableRes.Aggs)["histogram"].AggResponseValues.Values.AggResponseValuesValuesItemList) > 0
593593
}
594594
return false
595595
}, time.Second*10, time.Second)
@@ -613,7 +613,7 @@ func Test_searchAndFilterClient(t *testing.T) {
613613
})
614614
assert.NoError(t, err)
615615
if (*aggTableRes.Aggs)["top_values"] != nil && (*aggTableRes.Aggs)["top_values"].AggResponseValues != nil {
616-
return len((*aggTableRes.Aggs)["top_values"].AggResponseValues.Values) > 0
616+
return len((*aggTableRes.Aggs)["top_values"].AggResponseValues.Values.AggResponseValuesValuesItemList) > 0
617617
}
618618
return false
619619
}, time.Second*10, time.Second)
@@ -638,7 +638,7 @@ func Test_searchAndFilterClient(t *testing.T) {
638638
})
639639
assert.NoError(t, err)
640640
if (*aggTableRes.Aggs)["num_histogram"] != nil && (*aggTableRes.Aggs)["num_histogram"].AggResponseValues != nil {
641-
return len((*aggTableRes.Aggs)["num_histogram"].AggResponseValues.Values) > 0
641+
return len((*aggTableRes.Aggs)["num_histogram"].AggResponseValues.Values.AggResponseValuesValuesItemList) > 0
642642
}
643643
return false
644644
}, time.Second*10, time.Second)

xata/branch_client.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ type BranchRequest struct {
1515
BranchName string
1616
}
1717

18+
type BranchMetadataWS xatagenworkspace.BranchMetadata
19+
1820
type CreateBranchRequestPayload struct {
1921
CreateBranchRequestFrom *string
20-
Metadata *BranchMetadata
22+
Metadata *BranchMetadataWS
2123
}
2224

2325
type CreateBranchRequest struct {

0 commit comments

Comments
 (0)