MCPcopy Create free account
hub / github.com/beeker1121/goque / EnqueueObjectAsJSON

Method EnqueueObjectAsJSON

queue.go:114–121  ·  view source on GitHub ↗

EnqueueObjectAsJSON is a helper function for Enqueue that accepts any value type, which is then encoded into a JSON byte slice using encoding/json. Use this function to handle encoding of complex types.

(value interface{})

Source from the content-addressed store, hash-verified

112//
113// Use this function to handle encoding of complex types.
114func (q *Queue) EnqueueObjectAsJSON(value interface{}) (*Item, error) {
115 jsonBytes, err := json.Marshal(value)
116 if err != nil {
117 return nil, err
118 }
119
120 return q.Enqueue(jsonBytes)
121}
122
123// Dequeue removes the next item in the queue and returns it.
124func (q *Queue) Dequeue() (*Item, error) {

Calls 1

EnqueueMethod · 0.95