client changes

This commit is contained in:
Sangeet Kumar 2024-10-03 21:45:17 +05:30
parent 68414597e6
commit 2f9392955b
2 changed files with 14 additions and 2 deletions

5
Makefile Normal file
View File

@ -0,0 +1,5 @@
all:
go build -o elasticstream cmd/main.go
clean:
rm -f elasticstream

View File

@ -1,6 +1,8 @@
package elasticstream
import (
"fmt"
"github.com/elastic/go-elasticsearch/v8"
)
@ -41,8 +43,13 @@ func (c *Client) Open() error {
return nil
}
func (c *Client) Read() (Data, error) {
return Data{}, nil
func (c *Client) Read() (*Data, error) {
data, ok := <-c.ch
if !ok {
return nil, fmt.Errorf("error reading data from channel")
}
return &data, nil
}
// func (c *Client) Ack(ctx context.Context, position int) error {