mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-04 20:20:19 +00:00
c4f79d455f
As kubernetes 1.24.0 is released, updating kubernetes dependencies to 1.24.0 updates: #3086 Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
31 lines
555 B
Go
31 lines
555 B
Go
package semver
|
|
|
|
import (
|
|
"database/sql/driver"
|
|
"fmt"
|
|
)
|
|
|
|
// Scan implements the database/sql.Scanner interface.
|
|
func (v *Version) Scan(src interface{}) (err error) {
|
|
var str string
|
|
switch src := src.(type) {
|
|
case string:
|
|
str = src
|
|
case []byte:
|
|
str = string(src)
|
|
default:
|
|
return fmt.Errorf("version.Scan: cannot convert %T to string", src)
|
|
}
|
|
|
|
if t, err := Parse(str); err == nil {
|
|
*v = t
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Value implements the database/sql/driver.Valuer interface.
|
|
func (v Version) Value() (driver.Value, error) {
|
|
return v.String(), nil
|
|
}
|