From 08d8f0b37c8282a5a3218d465b023a0d6e7500f4 Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Mon, 24 May 2021 16:11:02 -0700 Subject: [PATCH] Add String method to TaskState --- asynq.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/asynq.go b/asynq.go index 0e3d77e..5e452ea 100644 --- a/asynq.go +++ b/asynq.go @@ -123,6 +123,22 @@ const ( TaskStateArchived ) +func (s TaskState) String() string { + switch s { + case TaskStateActive: + return "active" + case TaskStatePending: + return "pending" + case TaskStateScheduled: + return "scheduled" + case TaskStateRetry: + return "retry" + case TaskStateArchived: + return "archived" + } + panic("asynq: unknown task state") +} + // RedisConnOpt is a discriminated union of types that represent Redis connection configuration option. // // RedisConnOpt represents a sum of following types: