func makePK(name string) *gorma.RelationalFieldDefinition {

	f := &gorma.RelationalFieldDefinition{}
	f.Name = dsl.SanitizeFieldName(name)
	f.DatabaseFieldName = dsl.SanitizeDBFieldName(f.Name)
	f.Datatype = gorma.PKInteger
	return f

}
func makePK(name string) *gorma.RelationalFieldDefinition {

	f := &gorma.RelationalFieldDefinition{}
	f.FieldName = dsl.SanitizeFieldName(name)
	f.DatabaseFieldName = dsl.SanitizeDBFieldName(f.FieldName)
	f.Datatype = gorma.Integer
	f.PrimaryKey = true
	return f

}
func TestPKWhereSingle(t *testing.T) {
	sg := &gorma.RelationalModelDefinition{}
	sg.RelationalFields = make(map[string]*gorma.RelationalFieldDefinition)
	f := &gorma.RelationalFieldDefinition{}
	f.Name = dsl.SanitizeFieldName("ID")
	f.DatabaseFieldName = dsl.SanitizeDBFieldName(f.Name)
	f.Datatype = gorma.PKInteger

	sg.RelationalFields[f.Name] = f
	sg.PrimaryKeys = append(sg.PrimaryKeys, f)

	pkw := sg.PKWhere()

	if pkw != "id = ?" {
		t.Errorf("Expected %s, got %s", "id = ?", pkw)
	}

}
func TestPKUpdateFieldsSingle(t *testing.T) {
	sg := &gorma.RelationalModelDefinition{}
	sg.RelationalFields = make(map[string]*gorma.RelationalFieldDefinition)
	f := &gorma.RelationalFieldDefinition{}
	f.FieldName = dsl.SanitizeFieldName("ID")
	f.DatabaseFieldName = dsl.SanitizeDBFieldName(f.FieldName)
	f.Datatype = gorma.Integer
	f.PrimaryKey = true

	sg.RelationalFields[f.FieldName] = f
	sg.PrimaryKeys = append(sg.PrimaryKeys, f)

	pkw := sg.PKUpdateFields("model")

	if pkw != "model.ID" {
		t.Errorf("Expected %s, got %s", "model.ID", pkw)
	}

}