// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the APIAudit fields.
assignValues assigns the values that were returned from sql.Rows (after scanning)
to the APIAudit fields.
// assignValues assigns the values that were returned from sql . Rows ( after scanning ) // to the APIAudit fields .
func (aa *APIAudit) 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 apiaudit.FieldID:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field id", values[i])
			} else if value.Valid {
				aa.ID = value.String
			}
		case apiaudit.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 {
				aa.CreatedAt = value.Time
			}
		case apiaudit.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 {
				aa.UpdatedAt = value.Time
			}
		case apiaudit.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 {
				aa.DeletedAt = new(time.Time)
				*aa.DeletedAt = value.Time
			}
		case apiaudit.FieldPlane:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field plane", values[i])
			} else if value.Valid {
				aa.Plane = value.String
			}
		case apiaudit.FieldHashedGrantToken:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field hashed_grant_token", values[i])
			} else if value.Valid {
				aa.HashedGrantToken = value.String
			}
		case apiaudit.FieldDomain:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field domain", values[i])
			} else if value.Valid {
				aa.Domain = value.String
			}
		case apiaudit.FieldHTTPPath:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field http_path", values[i])
			} else if value.Valid {
				aa.HTTPPath = value.String
			}
		case apiaudit.FieldHTTPMethod:
			if value, ok := values[i].(*sql.NullString); !ok {
				return fmt.Errorf("unexpected type %T for field http_method", values[i])
			} else if value.Valid {
				aa.HTTPMethod = value.String
			}
		case apiaudit.FieldSentHTTPStatus:
			if value, ok := values[i].(*sql.NullInt64); !ok {
				return fmt.Errorf("unexpected type %T for field sent_http_status", values[i])
			} else if value.Valid {
				aa.SentHTTPStatus = int(value.Int64)
			}
		}
	}
	return nil
}
func ( aa * APIAudit ) 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 apiaudit . FieldID : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { aa . ID = value . String } case apiaudit . FieldCreatedAt : if value , ok := values [ i ] . ( * sql . NullTime ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { aa . CreatedAt = value . Time } case apiaudit . FieldUpdatedAt : if value , ok := values [ i ] . ( * sql . NullTime ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { aa . UpdatedAt = value . Time } case apiaudit . FieldDeletedAt : if value , ok := values [ i ] . ( * sql . NullTime ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { aa . DeletedAt = new ( time . Time ) * aa . DeletedAt = value . Time } case apiaudit . FieldPlane : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { aa . Plane = value . String } case apiaudit . FieldHashedGrantToken : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { aa . HashedGrantToken = value . String } case apiaudit . FieldDomain : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { aa . Domain = value . String } case apiaudit . FieldHTTPPath : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { aa . HTTPPath = value . String } case apiaudit . FieldHTTPMethod : if value , ok := values [ i ] . ( * sql . NullString ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { aa . HTTPMethod = value . String } case apiaudit . FieldSentHTTPStatus : if value , ok := values [ i ] . ( * sql . NullInt64 ) ; ! ok { return fmt . Errorf ( " " , values [ i ] ) } else if value . Valid { aa . SentHTTPStatus = int ( value . Int64 ) } } } return nil }
assignValues assigns the values that were returned from sql.Rows (after scanning)
to the APIAudit fields.
assignValues assigns the values that were returned from sql . Rows ( after scanning ) to the APIAudit fields .