MCPcopy Create free account
hub / github.com/Masterminds/semver / Scan

Method Scan

version.go:597–620  ·  view source on GitHub ↗

Scan implements the SQL.Scanner interface.

(value interface{})

Source from the content-addressed store, hash-verified

595
596// Scan implements the SQL.Scanner interface.
597func (v *Version) Scan(value interface{}) error {
598 var s string
599 switch t := value.(type) {
600 case string:
601 s = t
602 case []byte:
603 s = string(t)
604 case nil:
605 return fmt.Errorf("cannot scan nil into Version")
606 default:
607 return fmt.Errorf("unsupported Scan type %T", value)
608 }
609 temp, err := NewVersion(s)
610 if err != nil {
611 return err
612 }
613 v.major = temp.major
614 v.minor = temp.minor
615 v.patch = temp.patch
616 v.pre = temp.pre
617 v.metadata = temp.metadata
618 v.original = temp.original
619 return nil
620}
621
622// Value implements the Driver.Valuer interface.
623func (v Version) Value() (driver.Value, error) {

Callers 1

TestScanInputTypesFunction · 0.95

Calls 1

NewVersionFunction · 0.85

Tested by 1

TestScanInputTypesFunction · 0.76