MCPcopy Create free account
hub / github.com/OpenFunction/samples / getEventData

Function getEventData

functions/async/pubsub/producer/producer.go:143–159  ·  view source on GitHub ↗
(index int)

Source from the content-addressed store, hash-verified

141}
142
143func getEventData(index int) []byte {
144 r := requestContent{
145 ID: fmt.Sprintf("p%d-%s", index, uuid.New().String()),
146 Data: []byte(getData(256)),
147 Time: time.Now().UTC().Unix(),
148 }
149
150 // hash the entire message
151 inSha := sha256.Sum256(r.Data)
152 r.Sha = string(inSha[:])
153
154 b, err := json.Marshal(r)
155 if err != nil {
156 logger.Fatalf("error generating request: %v", err)
157 }
158 return b
159}
160
161func getData(length int) string {
162 seededRand := rand.New(rand.NewSource(time.Now().UnixNano()))

Callers 1

publishFunction · 0.85

Calls 1

getDataFunction · 0.85

Tested by

no test coverage detected