Skip to content

Instantly share code, notes, and snippets.

@batmany13
Created August 21, 2017 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save batmany13/817b1e42975910c0f505cead5858c190 to your computer and use it in GitHub Desktop.
Save batmany13/817b1e42975910c0f505cead5858c190 to your computer and use it in GitHub Desktop.
Value and Scan for Synq Video object
func (v Video) Value() (driver.Value, error) {
json, err := json.Marshal(v)
return json, err
}
func (v *Video) Scan(src interface{}) error {
source, ok := src.([]byte)
if !ok {
return errors.New("Type assertion .([]byte) failed.")
}
err := json.Unmarshal(source, &v)
if err != nil {
return err
}
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment