예제 #1
0
// Compare tells you, in one pass, whether or not the first row matches, is less than, or greater than the second row
func (c *GrantAttributeSchema) Compare(obj interface{}) int {
	c2, ok := obj.(*GrantAttributeSchema)
	if !ok {
		fmt.Println("Error!!!, Compare needs a GrantAttributeSchema instance", c2)
		return +999
	}

	val := misc.CompareStrings(c.get("schema"), c2.get("schema"))
	if val != 0 {
		return val
	}

	val = misc.CompareStrings(c.get("relationship_name"), c2.get("relationship_name"))
	if val != 0 {
		return val
	}

	val = misc.CompareStrings(c.get("attribute_name"), c2.get("attribute_name"))
	if val != 0 {
		return val
	}

	role1, _ := parseAcl(c.get("attribute_acl"))
	role2, _ := parseAcl(c2.get("attribute_acl"))
	val = misc.CompareStrings(role1, role2)
	return val
}
예제 #2
0
파일: trigger.go 프로젝트: joncrlsn/pgdiff
// Compare tells you, in one pass, whether or not the first row matches, is less than, or greater than the second row
func (c *TriggerSchema) Compare(obj interface{}) int {
	c2, ok := obj.(*TriggerSchema)
	if !ok {
		fmt.Println("Error!!!, Compare(obj) needs a TriggerSchema instance", c2)
		return +999
	}

	val := misc.CompareStrings(c.get("table_name"), c2.get("table_name"))
	if val != 0 {
		return val
	}
	val = misc.CompareStrings(c.get("trigger_name"), c2.get("trigger_name"))
	return val
}
예제 #3
0
// Compare tells you, in one pass, whether or not the first row matches, is less than, or greater than the second row
func (c *ForeignKeySchema) Compare(obj interface{}) int {
	c2, ok := obj.(*ForeignKeySchema)
	if !ok {
		fmt.Println("Error!!!, Compare(obj) needs a ForeignKeySchema instance", c2)
		return +999
	}

	//fmt.Printf("Comparing %s with %s", c.get("table_name"), c2.get("table_name"))
	val := misc.CompareStrings(c.get("table_name"), c2.get("table_name"))
	if val != 0 {
		return val
	}

	val = misc.CompareStrings(c.get("constraint_def"), c2.get("constraint_def"))
	return val
}
예제 #4
0
파일: column.go 프로젝트: SparkeyG/pgdiff
// Compare tells you, in one pass, whether or not the first row matches, is less than, or greater than the second row
func (c *ColumnSchema) Compare(obj interface{}) int {
	c2, ok := obj.(*ColumnSchema)
	if !ok {
		fmt.Println("Error!!!, Compare needs a ColumnSchema instance", c2)
	}

	val := misc.CompareStrings(c.get("table_name"), c2.get("table_name"))
	if val != 0 {
		// Table name differed so return that value
		return val
	}

	// Table name was the same so compare column name
	val = misc.CompareStrings(c.get("column_name"), c2.get("column_name"))
	return val
}
예제 #5
0
파일: sequence.go 프로젝트: joncrlsn/pgdiff
// Compare tells you, in one pass, whether or not the first row matches, is less than, or greater than the second row
func (c *SequenceSchema) Compare(obj interface{}) int {
	c2, ok := obj.(*SequenceSchema)
	if !ok {
		fmt.Println("Error!!!, Compare(obj) needs a SequenceSchema instance", c2)
		return +999
	}

	val := misc.CompareStrings(c.get("sequence_name"), c2.get("sequence_name"))
	return val
}
예제 #6
0
파일: owner.go 프로젝트: joncrlsn/pgdiff
// Compare tells you, in one pass, whether or not the first row matches, is less than, or greater than the second row
func (c *OwnerSchema) Compare(obj interface{}) int {
	c2, ok := obj.(*OwnerSchema)
	if !ok {
		fmt.Println("Error!!!, Compare needs a OwnerSchema instance", c2)
		return +999
	}

	val := misc.CompareStrings(c.get("relationship_name"), c2.get("relationship_name"))
	return val
}
예제 #7
0
파일: role.go 프로젝트: SparkeyG/pgdiff
// Compare tells you, in one pass, whether or not the first row matches, is less than, or greater than the second row
func (c *RoleSchema) Compare(obj interface{}) int {
	c2, ok := obj.(*RoleSchema)
	if !ok {
		fmt.Println("Error!!!, change needs a RoleSchema instance", c2)
		return +999
	}

	val := misc.CompareStrings(c.get("rolname"), c2.get("rolname"))
	return val
}
예제 #8
0
파일: function.go 프로젝트: joncrlsn/pgdiff
// Compare tells you, in one pass, whether or not the first row matches, is less than, or greater than the second row
func (c *FunctionSchema) Compare(obj interface{}) int {
	c2, ok := obj.(*FunctionSchema)
	if !ok {
		fmt.Println("Error!!!, Compare(obj) needs a FunctionSchema instance", c2)
		return +999
	}

	val := misc.CompareStrings(c.get("function_name"), c2.get("function_name"))
	//fmt.Printf("-- Compared %v: %s with %s \n", val, c.get("function_name"), c2.get("function_name"))
	return val
}