mirror of
https://github.com/hibiken/asynq.git
synced 2025-10-03 05:12:01 +08:00
Add Hash method to Payload
This commit is contained in:
@@ -19,6 +19,12 @@ func (e *errKeyNotFound) Error() string {
|
||||
return fmt.Sprintf("key %q does not exist", e.key)
|
||||
}
|
||||
|
||||
// Has reports whether key exists.
|
||||
func (p Payload) Has(key string) bool {
|
||||
_, ok := p[key]
|
||||
return ok
|
||||
}
|
||||
|
||||
// GetString returns a string value if a string type is associated with
|
||||
// the key, otherwise reports an error.
|
||||
func (p Payload) GetString(key string) (string, error) {
|
||||
|
Reference in New Issue
Block a user