pip compatible server to serve Python packages out of GitHub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

31 lines
593 B

package semver
import (
"database/sql/driver"
"fmt"
)
// Scan implements the database/sql.Scanner interface.
func (v *Version) Scan(src interface{}) (err error) {
var strVal string
switch src.(type) {
case string:
strVal = src.(string)
case []byte:
strVal = string(src.([]byte))
default:
return fmt.Errorf("Version.Scan: cannot convert %T to string.", src)
}
tmpv, err := Parse(strVal)
if err != nil {
return
}
*v = *tmpv
return
}
// Value implements the database/sql/driver.Valuer interface.
func (s Version) Value() (driver.Value, error) {
return s.String(), nil
}