@@ -28,16 +28,20 @@ func NewSourceClient(cc grpc.ClientConnInterface) *SourceClient {
2828 }
2929}
3030
31- func (c * SourceClient ) GetTables (ctx context.Context ) ([] * schema. Table , error ) {
32- res , err := c .pbClient .GetTables (ctx , & pb.GetTables_Request {})
31+ func (c * SourceClient ) Name (ctx context.Context ) (string , error ) {
32+ res , err := c .pbClient .GetName (ctx , & pb.GetName_Request {})
3333 if err != nil {
34- return nil , err
34+ return "" , fmt . Errorf ( "failed to get name: %w" , err )
3535 }
36- var tables []* schema.Table
37- if err := json .Unmarshal (res .Tables , & tables ); err != nil {
38- return nil , err
36+ return res .Name , nil
37+ }
38+
39+ func (c * SourceClient ) Version (ctx context.Context ) (string , error ) {
40+ res , err := c .pbClient .GetVersion (ctx , & pb.GetVersion_Request {})
41+ if err != nil {
42+ return "" , fmt .Errorf ("failed to get version: %w" , err )
3943 }
40- return tables , nil
44+ return res . Version , nil
4145}
4246
4347func (c * SourceClient ) ExampleConfig (ctx context.Context ) (string , error ) {
@@ -48,6 +52,18 @@ func (c *SourceClient) ExampleConfig(ctx context.Context) (string, error) {
4852 return res .Config , nil
4953}
5054
55+ func (c * SourceClient ) GetTables (ctx context.Context ) ([]* schema.Table , error ) {
56+ res , err := c .pbClient .GetTables (ctx , & pb.GetTables_Request {})
57+ if err != nil {
58+ return nil , err
59+ }
60+ var tables []* schema.Table
61+ if err := json .Unmarshal (res .Tables , & tables ); err != nil {
62+ return nil , err
63+ }
64+ return tables , nil
65+ }
66+
5167func (c * SourceClient ) Sync (ctx context.Context , spec specs.Source , res chan <- * schema.Resource ) error {
5268 b , err := json .Marshal (spec )
5369 if err != nil {
0 commit comments