Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correctness of ContentTypeJson value #191

Open
karthiksedoc opened this issue Dec 6, 2024 · 2 comments
Open

correctness of ContentTypeJson value #191

karthiksedoc opened this issue Dec 6, 2024 · 2 comments

Comments

@karthiksedoc
Copy link

Looks like the following:

	eventData := esdb.EventData{
		ContentType: esdb.ContentTypeJson,
		EventType:   "TestEvent",
		Data:        data,
	}

in https://github.com/EventStore/EventStore-Client-Go/blob/c29aa7d3ce9c0aadc7d2bfa3dd060f2865efb227/samples/quickstart.go#L42C21-L42C36 is incorrect , does it have to be int as in below?

ContentTypeJson ContentType = 1

the following code works for me:

	eventData := esdb.EventData {
		ContentType: 1,
		EventType: "TestEvent",
		Data: data,
	}

So, the ContentType: esdb.ContentTypeJson need to be changed to ContentType: 1 ?

@YoEight
Copy link
Member

YoEight commented Dec 6, 2024

Hey @karthiksedoc,

I'm a bit confused by your question. See esdb.ContentTypeJson is a regular integer as shown at its declaration site.

https://github.com/EventStore/EventStore-Client-Go/blob/v4.2.0/esdb/event_data.go

So it is normal to be able to use either 1 or esdb.ContentTypeJson.

@karthiksedoc
Copy link
Author

karthiksedoc commented Dec 9, 2024

Hey @karthiksedoc,

I'm a bit confused by your question. See esdb.ContentTypeJson is a regular integer as shown at its declaration site.

https://github.com/EventStore/EventStore-Client-Go/blob/v4.2.0/esdb/event_data.go

So it is normal to be able to use either 1 or esdb.ContentTypeJson.

Thanks for getting back to me @YoEight 👍 . I might be not setting it properly:

When I set:

        eventData := esdb.EventData {
                ContentType: esdb.ContentTypeJson,
                EventType: "TestEvent",
                Data: data,
        }

I get the follow:

➜  gorpc_test git:(main) go build main.go 
# command-line-arguments
./main.go:42:21: undefined: esdb.ContentTypeJson

the build works without error when setting:

	eventData := esdb.EventData {
		ContentType: 1,
		EventType: "TestEvent",
		Data: data,
	}

I was following the example and encountered this 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants