diff --git a/README.md b/README.md index cc69746..0d988eb 100644 --- a/README.md +++ b/README.md @@ -61,11 +61,7 @@ You can copy `config.spec` from the root of this repo and modify as needed. ```shell go install google.golang.org/protobuf/cmd/protoc-gen-go@latest export PATH=$PATH:$HOME/go/bin -protoc --proto_path=/path/to/rai-sdk-go/protos/proto \ - --go_out=/path/to/rai-sdk-go/protos \ - --go_opt=Mschema.proto=./generated \ - --go_opt=Mmessage.proto=./generated \ - /path/to/rai-sdk-go/protos/proto/*.proto +protoc -I protos --go_out=. --go_opt=Mschema.proto=./rai/pb --go_opt=Mmessage.proto=./rai/pb protos/*.proto ``` ## Examples diff --git a/protos/proto/message.proto b/protos/message.proto similarity index 100% rename from protos/proto/message.proto rename to protos/message.proto diff --git a/protos/proto/schema.proto b/protos/schema.proto similarity index 100% rename from protos/proto/schema.proto rename to protos/schema.proto diff --git a/rai/client.go b/rai/client.go index 0152ad0..fc3c179 100644 --- a/rai/client.go +++ b/rai/client.go @@ -33,7 +33,7 @@ import ( "github.com/apache/arrow/go/v7/arrow/ipc" "github.com/pkg/errors" - "github.com/relationalai/rai-sdk-go/protos/generated" + "github.com/relationalai/rai-sdk-go/rai/pb" "google.golang.org/protobuf/proto" ) @@ -330,7 +330,7 @@ func unmarshal(rsp *http.Response, result interface{}) error { } return errors.Errorf("unhandled unmarshal type %T", result) - case generated.MetadataInfo: + case pb.MetadataInfo: srcValues := reflect.ValueOf(data) dstValues.Set(srcValues) return nil @@ -451,7 +451,7 @@ func parseHttpResponse(rsp *http.Response) (interface{}, error) { boundary := params["boundary"] return parseMultipartResponse(data, boundary) } else if mediaType == "application/x-protobuf" { - var metadataInfo generated.MetadataInfo + var metadataInfo pb.MetadataInfo err := proto.Unmarshal(data, &metadataInfo) if err != nil { return nil, err @@ -492,7 +492,7 @@ func (c *Client) request( // readTransactionAsyncFiles reads the transaction async results from TransactionAsyncFiles func readTransactionAsyncFiles(files []TransactionAsyncFile) (*TransactionAsyncResult, error) { var txn TransactionAsyncResponse - var metadata generated.MetadataInfo + var metadata pb.MetadataInfo var problems []interface{} for _, file := range files { @@ -1304,8 +1304,8 @@ func (c *Client) GetTransactionResults(id string) ([]ArrowRelation, error) { return result, err } -func (c *Client) GetTransactionMetadata(id string) (generated.MetadataInfo, error) { - var result generated.MetadataInfo +func (c *Client) GetTransactionMetadata(id string) (pb.MetadataInfo, error) { + var result pb.MetadataInfo headers := map[string]string{ "Accept": "application/x-protobuf", } diff --git a/rai/client_test.go b/rai/client_test.go index c8b00f7..c273b22 100644 --- a/rai/client_test.go +++ b/rai/client_test.go @@ -24,7 +24,7 @@ import ( "testing" "github.com/google/uuid" - "github.com/relationalai/rai-sdk-go/protos/generated" + "github.com/relationalai/rai-sdk-go/rai/pb" "github.com/stretchr/testify/assert" "google.golang.org/protobuf/proto" ) @@ -337,7 +337,7 @@ func TestExecuteAsync(t *testing.T) { assert.Equal(t, rsp.Results[0].Table, expectedResults[0].Table) - var expectedMetadata generated.MetadataInfo + var expectedMetadata pb.MetadataInfo data, _ := os.ReadFile("./metadata.pb") proto.Unmarshal(data, &expectedMetadata) diff --git a/rai/models.go b/rai/models.go index 5fe5d95..9e14d71 100644 --- a/rai/models.go +++ b/rai/models.go @@ -17,7 +17,7 @@ package rai import ( "time" - "github.com/relationalai/rai-sdk-go/protos/generated" + "github.com/relationalai/rai-sdk-go/rai/pb" ) // REST API v1 @@ -303,6 +303,6 @@ type TransactionAsyncResult struct { GotCompleteResult bool Transaction TransactionAsyncResponse Results []ArrowRelation - Metadata generated.MetadataInfo + Metadata pb.MetadataInfo Problems []interface{} } diff --git a/protos/generated/message.pb.go b/rai/pb/message.pb.go similarity index 99% rename from protos/generated/message.pb.go rename to rai/pb/message.pb.go index 1acb774..13d1f7e 100644 --- a/protos/generated/message.pb.go +++ b/rai/pb/message.pb.go @@ -1,10 +1,10 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 -// protoc v3.19.0 +// protoc-gen-go v1.28.1 +// protoc v3.19.4 // source: message.proto -package generated +package pb import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/protos/generated/schema.pb.go b/rai/pb/schema.pb.go similarity index 99% rename from protos/generated/schema.pb.go rename to rai/pb/schema.pb.go index 936dd55..d4c3ad3 100644 --- a/protos/generated/schema.pb.go +++ b/rai/pb/schema.pb.go @@ -1,10 +1,10 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 -// protoc v3.19.0 +// protoc-gen-go v1.28.1 +// protoc v3.19.4 // source: schema.proto -package generated +package pb import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect"