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 package elasticstream
import ( import (
"fmt"
"github.com/elastic/go-elasticsearch/v8" "github.com/elastic/go-elasticsearch/v8"
) )
@ -41,8 +43,13 @@ func (c *Client) Open() error {
return nil return nil
} }
func (c *Client) Read() (Data, error) { func (c *Client) Read() (*Data, error) {
return Data{}, nil
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 { // func (c *Client) Ack(ctx context.Context, position int) error {