Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | package postgres |
||
2 | |||
3 | import "sort" |
||
4 | |||
5 | const ( |
||
6 | RelationTuplesTable = "relation_tuples" |
||
7 | AttributesTable = "attributes" |
||
8 | SchemaDefinitionTable = "schema_definitions" |
||
9 | TransactionsTable = "transactions" |
||
10 | TenantsTable = "tenants" |
||
11 | BundlesTable = "bundles" |
||
12 | ) |
||
13 | |||
14 | // isSameArray - check if two arrays are the same |
||
15 | func isSameArray(a, b []string) bool { |
||
16 | if len(a) != len(b) { |
||
17 | return false |
||
18 | } |
||
19 | |||
20 | sortedA := make([]string, len(a)) |
||
21 | copy(sortedA, a) |
||
22 | sort.Strings(sortedA) |
||
23 | |||
24 | sortedB := make([]string, len(b)) |
||
25 | copy(sortedB, b) |
||
26 | sort.Strings(sortedB) |
||
27 | |||
28 | for i := range sortedA { |
||
29 | if sortedA[i] != sortedB[i] { |
||
30 | return false |
||
31 | } |
||
32 | } |
||
33 | |||
34 | return true |
||
35 | } |
||
36 |