// ConvertColumnsFromModel converts WorkitemTypeBoard model to a response
// resource object for jsonapi.org specification
767662
func ConvertColumnsFromModel(request *http.Request, column workitem.BoardColumn) *app.WorkItemBoardColumnData {
	return &app.WorkItemBoardColumnData{
		ID:   column.ID,
		Type: APIBoardColumns,
		Attributes: &app.WorkItemBoardColumnAttributes{
			Name:  column.Name,
			Order: &column.Order,
		},
	}
}
43630
func Convert_apiextensions_CustomResourceColumnDefinition_To_v1beta1_CustomResourceColumnDefinition(in *apiextensions.CustomResourceColumnDefinition, out *CustomResourceColumnDefinition, s conversion.Scope) error {
	return autoConvert_apiextensions_CustomResourceColumnDefinition_To_v1beta1_CustomResourceColumnDefinition(in, out, s)
}
263464
func convertTermObj(o map[string]interface{}) termsObj {
	if len(o) == 0 {
		return nil
	}

	terms := make(termsObj, len(o))
	for k, v := range o {
		terms[k] = Expr(v)
	}

	return terms
}
159990
func (f *Field) ServiceType(m *Model) *Type {
	return m.TypeWithTypeName(f.NativeType)
}
711961
func (original Transform) TransformFromJSON(from, to Transform, fncMap template.FuncMap) (string, error) {
	jsonParsed, _ := gabs.ParseJSON([]byte(from))
	ch, _ := jsonParsed.ChildrenMap()
	path := ""
	values := make(map[string]string)
	walkTreeJSON(ch, &path, values)
	oriParsed, _ := gabs.ParseJSON([]byte(original))
	parsedMap := make(map[string]string)
	for k, v := range values {
		parsedMap[cleanString(v)] = cleanString(oriParsed.Path(k).String())
	}
	return generateTransformedMessage(parsedMap, to, fncMap)
}
654457
func (m *ModelStatus) UnitWorkloadVersion(unitName string) (string, error) {
	info, err := m.getStatus(globalWorkloadVersionKey(unitName), "workload")
	if err != nil {
		return "", err
	}
	return info.Message, nil
}
992244
func ConvertBoardColumnsSimple(request *http.Request, labelIDs []interface{}) []*app.GenericData {
	ops := make([]*app.GenericData, 0, len(labelIDs))
	for _, labelID := range labelIDs {
		ops = append(ops, ConvertBoardColumnSimple(request, labelID))
	}
	return ops
}
377833
func ParseModels(data []byte) (map[string]*ControllerModels, error) {
	var result modelsCollection
	err := yaml.Unmarshal(data, &result)
	if err != nil {
		return nil, errors.Annotate(err, "cannot unmarshal models")
	}
	return result.ControllerModels, nil
}
97460
func (t ListType) ConvertToModel(value interface{}) (interface{}, error) {
	// the assumption is that work item types do not change over time...only new ones can be created
	return ConvertList(func(fieldType FieldType, value interface{}) (interface{}, error) {
		return fieldType.ConvertToModel(value)
	}, t.ComponentType, value)

}
580059
func ConvertLabelSimple(request *http.Request, labelID interface{}) *app.GenericData {
	i := fmt.Sprint(labelID)
	return &app.GenericData{
		Type: ptr.String(label.APIStringTypeLabels),
		ID:   &i,
	}
}
991797
func ConvertFieldNames(obj interface{}, jsonFields string) string {
	if jsonFields != "" {
		fields := strings.Split(jsonFields, ",")

		length := len(fields)
		if length > 0 {
			mapping := fieldNameMapping(obj)

			var forceFields []string
			for _, field := range fields {
				if forceField, ok := mapping[field]; ok {
					forceFields = append(forceFields, forceField)
				}
			}

			return strings.Join(forceFields, ",")
		}
	}

	return ""
}
649037
func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int64, opt *ListOptions) ([]*ProjectColumn, *Response, error) {
	u := fmt.Sprintf("projects/%v/columns", projectID)
	u, err := addOptions(u, opt)
	if err != nil {
		return nil, nil, err
	}

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	// TODO: remove custom Accept headers when APIs fully launch.
	req.Header.Set("Accept", mediaTypeProjectsPreview)

	columns := []*ProjectColumn{}
	resp, err := s.client.Do(ctx, req, &columns)
	if err != nil {
		return nil, resp, err
	}

	return columns, resp, nil
}
152188
func (tl TypeLoader) LoadIndexColumns(args *ArgType, ixTpl *Index) error {
	var err error

	// load index columns
	indexCols, err := tl.IndexColumnList(args.DB, args.Schema, ixTpl.Type.Table.TableName, ixTpl.Index.IndexName)
	if err != nil {
		return err
	}

	// process index columns
	for _, ic := range indexCols {
		var field *Field

	fieldLoop:
		// find field
		for _, f := range ixTpl.Type.Fields {
			if f.Col.ColumnName == ic.ColumnName {
				field = f
				break fieldLoop
			}
		}

		if field == nil {
			continue
		}

		ixTpl.Fields = append(ixTpl.Fields, field)
	}

	return nil
}
713435
func (r *GormBoardRepository) loadColumns(ctx context.Context, boardID uuid.UUID) ([]BoardColumn, error) {
	columns := []BoardColumn{}
	db := r.db.Model(&columns).Where("board_id=?", boardID).Order("column_order ASC").Find(&columns)
	if db.RecordNotFound() {
		log.Error(ctx, map[string]interface{}{"board_id": boardID}, "work item board columns not found")
		return nil, errors.NewNotFoundError("work item board columns of board", boardID.String())
	}
	if err := db.Error; err != nil {
		return nil, errors.NewInternalError(ctx, err)
	}
	return columns, nil
}
882725
func (r Hardware_SecurityModule) GetItemPricesFromSoftwareDescriptions(softwareDescriptions []datatypes.Software_Description, includeTranslationsFlag *bool, returnAllPricesFlag *bool) (resp []datatypes.Product_Item, err error) {
	params := []interface{}{
		softwareDescriptions,
		includeTranslationsFlag,
		returnAllPricesFlag,
	}
	err = r.Session.DoRequest("SoftLayer_Hardware_SecurityModule", "getItemPricesFromSoftwareDescriptions", params, &r.Options, &resp)
	return
}
776686
func findColumnNamesInExpr(expr ast.ExprNode) []*ast.ColumnName {
	var c generatedColumnChecker
	expr.Accept(&c)
	return c.cols
}
271524
func ParseModelType(raw string) (ModelType, error) {
	for _, typ := range []ModelType{ModelTypeIAAS, ModelTypeCAAS} {
		if raw == string(typ) {
			return typ, nil
		}
	}
	return "", errors.NotValidf("model type %v", raw)
}