one per type for package clashes Scan implements the Scanner interface.
(value interface{})
| 71 | |
| 72 | // Scan implements the Scanner interface. |
| 73 | func (x *JobState) Scan(value interface{}) (err error) { |
| 74 | if value == nil { |
| 75 | *x = JobState(0) |
| 76 | return |
| 77 | } |
| 78 | |
| 79 | // A wider range of scannable types. |
| 80 | // driver.Value values at the top of the list for expediency |
| 81 | switch v := value.(type) { |
| 82 | case int64: |
| 83 | *x = JobState(v) |
| 84 | case string: |
| 85 | *x, err = ParseJobState(v) |
| 86 | case []byte: |
| 87 | *x, err = ParseJobState(string(v)) |
| 88 | case JobState: |
| 89 | *x = v |
| 90 | case int: |
| 91 | *x = JobState(v) |
| 92 | case *JobState: |
| 93 | if v == nil { |
| 94 | return errJobStateNilPtr |
| 95 | } |
| 96 | *x = *v |
| 97 | case uint: |
| 98 | *x = JobState(v) |
| 99 | case uint64: |
| 100 | *x = JobState(v) |
| 101 | case *int: |
| 102 | if v == nil { |
| 103 | return errJobStateNilPtr |
| 104 | } |
| 105 | *x = JobState(*v) |
| 106 | case *int64: |
| 107 | if v == nil { |
| 108 | return errJobStateNilPtr |
| 109 | } |
| 110 | *x = JobState(*v) |
| 111 | case float64: // json marshals everything as a float64 if it's a number |
| 112 | *x = JobState(v) |
| 113 | case *float64: // json marshals everything as a float64 if it's a number |
| 114 | if v == nil { |
| 115 | return errJobStateNilPtr |
| 116 | } |
| 117 | *x = JobState(*v) |
| 118 | case *uint: |
| 119 | if v == nil { |
| 120 | return errJobStateNilPtr |
| 121 | } |
| 122 | *x = JobState(*v) |
| 123 | case *uint64: |
| 124 | if v == nil { |
| 125 | return errJobStateNilPtr |
| 126 | } |
| 127 | *x = JobState(*v) |
| 128 | case *string: |
| 129 | if v == nil { |
| 130 | return errJobStateNilPtr |