(s *schema.Schema, rows *sqlx.Rows, list []*schema.Resource, skipNil, recursive bool)
| 1031 | } |
| 1032 | |
| 1033 | func (tx *Transaction) decodeRows(s *schema.Schema, rows *sqlx.Rows, list []*schema.Resource, skipNil, recursive bool) ([]*schema.Resource, error) { |
| 1034 | for rows.Next() { |
| 1035 | data := map[string]interface{}{} |
| 1036 | rows.MapScan(data) |
| 1037 | |
| 1038 | var resource *schema.Resource |
| 1039 | resourceData := tx.decode(s, s.GetDbTableName(), skipNil, recursive, data) |
| 1040 | resource, err := schema.NewResource(s, resourceData) |
| 1041 | if err != nil { |
| 1042 | return nil, fmt.Errorf("Failed to decode rows") |
| 1043 | } |
| 1044 | list = append(list, resource) |
| 1045 | } |
| 1046 | |
| 1047 | return list, nil |
| 1048 | } |
| 1049 | |
| 1050 | func (tx *Transaction) decode(s *schema.Schema, tableName string, skipNil, recursive bool, data map[string]interface{}) map[string]interface{} { |
| 1051 | resourceData := map[string]interface{}{} |
no test coverage detected