// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Fact fields.
assignValues assigns the values that were returned from sql.Rows (after scanning)
to the Fact fields.
// assignValues assigns the values that were returned from sql . Rows ( after scanning ) // to the Fact fields .
func (f *Fact) 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 fact.FieldID:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field id", values[i])
			} else if value.Valid {
				f.ID = value.String
			}
		case fact.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 {
				f.CreatedAt = value.Time
			}
		case fact.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 {
				f.UpdatedAt = value.Time
			}
		case fact.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 {
				f.DeletedAt = new(time.Time)
				*f.DeletedAt = value.Time
			}
		case fact.FieldHashedValue:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field hashed_value", values[i])
			} else if value.Valid {
				f.HashedValue = value.String
			}
		case fact.FieldEncryptedValue:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field encrypted_value", values[i])
			} else if value.Valid {
				f.EncryptedValue = value.String
			}
		case fact.FieldDomain:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field domain", values[i])
			} else if value.Valid {
				f.Domain = value.String
			}
		case fact.ForeignKeys[0]:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field fact_type_facts", values[i])
			} else if value.Valid {
				f.fact_type_facts = new(string)
				*f.fact_type_facts = value.String
			}
		case fact.ForeignKeys[1]:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field scope_facts", values[i])
			} else if value.Valid {
				f.scope_facts = new(string)
				*f.scope_facts = value.String
			}
		}
	}
	return nil
}
func ( f * Fact ) 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 fact . FieldID : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { f . ID = value . String } case fact . FieldCreatedAt : if value , ok := values [ i ] . ( * sql . NullTime ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { f . CreatedAt = value . Time } case fact . FieldUpdatedAt : if value , ok := values [ i ] . ( * sql . NullTime ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { f . UpdatedAt = value . Time } case fact . FieldDeletedAt : if value , ok := values [ i ] . ( * sql . NullTime ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { f . DeletedAt = new ( time . Time ) * f . DeletedAt = value . Time } case fact . FieldHashedValue : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { f . HashedValue = value . String } case fact . FieldEncryptedValue : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { f . EncryptedValue = value . String } case fact . FieldDomain : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { f . Domain = value . String } case fact . ForeignKeys [ 0 ] : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { f . fact_type_facts = new ( string ) * f . fact_type_facts = value . String } case fact . ForeignKeys [ 1 ] : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { f . scope_facts = new ( string ) * f . scope_facts = value . String } } } return nil }
assignValues assigns the values that were returned from sql.Rows (after scanning)
to the Fact fields.
assignValues assigns the values that were returned from sql . Rows ( after scanning ) to the Fact fields .