Skip to content

Commit

Permalink
moving protos to rai/pb (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
NRHelmi authored Aug 29, 2022
1 parent ba8d4d3 commit ebe80bb
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 21 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions rai/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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",
}
Expand Down
4 changes: 2 additions & 2 deletions rai/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions rai/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -303,6 +303,6 @@ type TransactionAsyncResult struct {
GotCompleteResult bool
Transaction TransactionAsyncResponse
Results []ArrowRelation
Metadata generated.MetadataInfo
Metadata pb.MetadataInfo
Problems []interface{}
}
6 changes: 3 additions & 3 deletions protos/generated/message.pb.go → rai/pb/message.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions protos/generated/schema.pb.go → rai/pb/schema.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ebe80bb

Please sign in to comment.