summaryrefslogtreecommitdiff
path: root/job_status_extra.go
diff options
context:
space:
mode:
authorLukasz Wojciechowski <l.wojciechow@partner.samsung.com>2018-06-11 15:27:59 +0200
committerAlexander Mazuruk <a.mazuruk@samsung.com>2018-07-26 07:32:48 +0200
commitd58291aa7a8ceb67c78404ab67616b013e333a15 (patch)
tree1e7f2c10dd2b39e602d23acd28266cfb52804976 /job_status_extra.go
parent31062956851d43e63d3ee61f102d24313732848c (diff)
downloadweles-d58291aa7a8ceb67c78404ab67616b013e333a15.tar.gz
weles-d58291aa7a8ceb67c78404ab67616b013e333a15.tar.bz2
weles-d58291aa7a8ceb67c78404ab67616b013e333a15.zip
Implement sorting in ListJobs
Patch includes Aleksander's version of sorting function selector. Change-Id: I624bba4a07e39b0129c08d5a2513ad1e874c32cc Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com> Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Diffstat (limited to 'job_status_extra.go')
-rw-r--r--job_status_extra.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/job_status_extra.go b/job_status_extra.go
new file mode 100644
index 0000000..ed9968f
--- /dev/null
+++ b/job_status_extra.go
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+// File job_status_extra.go enhances generated JobStatus type.
+
+package weles
+
+// ToInt converts JobStatus to int.
+func (status JobStatus) ToInt() int {
+ switch status {
+ case JobStatusNEW:
+ return 1
+ case JobStatusPARSING:
+ return 2
+ case JobStatusDOWNLOADING:
+ return 3
+ case JobStatusWAITING:
+ return 4
+ case JobStatusRUNNING:
+ return 5
+ case JobStatusCOMPLETED:
+ return 6
+ case JobStatusFAILED:
+ return 7
+ case JobStatusCANCELED:
+ return 8
+ default:
+ return -1
+ }
+}