// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Scope fields.
assignValues assigns the values that were returned from sql.Rows (after scanning)
to the Scope fields.
// assignValues assigns the values that were returned from sql . Rows ( after scanning ) // to the Scope fields .
func (s *Scope) assignValues(columns []string, values []interface{}) error {
	if m, n := len(values), len(columns); m < n {
		return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
	}
	for i := range columns {
		switch columns[i] {
		case scope.FieldID:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field id", values[i])
			} else if value.Valid {
				s.ID = value.String
			}
		case scope.FieldCreatedAt:
			if value, ok := values[i].(*sql.NullTime); !ok {
				return fmt.Errorf("unexpected type %T for field created_at", values[i])
			} else if value.Valid {
				s.CreatedAt = value.Time
			}
		case scope.FieldUpdatedAt:
			if value, ok := values[i].(*sql.NullTime); !ok {
				return fmt.Errorf("unexpected type %T for field updated_at", values[i])
			} else if value.Valid {
				s.UpdatedAt = value.Time
			}
		case scope.FieldDeletedAt:
			if value, ok := values[i].(*sql.NullTime); !ok {
				return fmt.Errorf("unexpected type %T for field deleted_at", values[i])
			} else if value.Valid {
				s.DeletedAt = new(time.Time)
				*s.DeletedAt = value.Time
			}
		case scope.FieldCustomID:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field custom_id", values[i])
			} else if value.Valid {
				s.CustomID = value.String
			}
		case scope.FieldNonce:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field nonce", values[i])
			} else if value.Valid {
				s.Nonce = value.String
			}
		case scope.FieldDomain:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field domain", values[i])
			} else if value.Valid {
				s.Domain = value.String
			}
		}
	}
	return nil
}
func ( s * Scope ) assignValues ( columns [ ] string , values [ ] interface { } ) error { if m , n := len ( values ) , len ( columns ) ; m < n { return fmt . Errorf ( " " , m , n ) } for i := range columns { switch columns [ i ] { case scope . FieldID : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { s . ID = value . String } case scope . FieldCreatedAt : if value , ok := values [ i ] . ( * sql . NullTime ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { s . CreatedAt = value . Time } case scope . FieldUpdatedAt : if value , ok := values [ i ] . ( * sql . NullTime ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { s . UpdatedAt = value . Time } case scope . FieldDeletedAt : if value , ok := values [ i ] . ( * sql . NullTime ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { s . DeletedAt = new ( time . Time ) * s . DeletedAt = value . Time } case scope . FieldCustomID : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { s . CustomID = value . String } case scope . FieldNonce : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { s . Nonce = value . String } case scope . FieldDomain : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { s . Domain = value . String } } } return nil }
assignValues assigns the values that were returned from sql.Rows (after scanning)
to the Scope fields.
assignValues assigns the values that were returned from sql . Rows ( after scanning ) to the Scope fields .