MCPcopy Create free account
hub / github.com/abice/go-enum / Scan

Method Scan

example/sql_str_enum.go:73–136  ·  view source on GitHub ↗

one per type for package clashes Scan implements the Scanner interface.

(value interface{})

Source from the content-addressed store, hash-verified

71
72// Scan implements the Scanner interface.
73func (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

Callers 11

NewNullJobStateFunction · 0.45
ScanMethod · 0.45
getProjectStatusFunction · 0.45
getNullStrProjectStatusFunction · 0.45
getNullProjectStatusFunction · 0.45
getJobStateFunction · 0.45
getNullJobStateFunction · 0.45
getImageTypeFunction · 0.45
getNullImageTypeFunction · 0.45
getGreekGodFunction · 0.45
getNullGreekGodFunction · 0.45

Calls 2

JobStateTypeAlias · 0.85
ParseJobStateFunction · 0.85

Tested by 9

getProjectStatusFunction · 0.36
getNullStrProjectStatusFunction · 0.36
getNullProjectStatusFunction · 0.36
getJobStateFunction · 0.36
getNullJobStateFunction · 0.36
getImageTypeFunction · 0.36
getNullImageTypeFunction · 0.36
getGreekGodFunction · 0.36
getNullGreekGodFunction · 0.36