package grmi

import "strings"

type Field struct {
	Name             string
	ColumnName       string
	SortColumnName   string
	UrlParameterName string
	GoType           GoType
}

func NewField(name string, columnName string, urlParameterName string, goType GoType) Field {
	sortColumnName := strings.Replace(columnName, "[", "", -1)
	sortColumnName = strings.Replace(sortColumnName, "]", "", -1)
	return Field{name, columnName, sortColumnName, urlParameterName, goType}
}

func (field *Field) NewPredicate(predicateType func(Predicate) (string, error), values ...interface{}) Predicate {
	return NewPredicate(field.ColumnName, predicateType, values)
}
