Skip to content

Commit 9677212

Browse files
committed
space-saving type aliases
1 parent 35566c9 commit 9677212

File tree

7 files changed

+122
-119
lines changed

7 files changed

+122
-119
lines changed

Sources/CoreDataQueryInterface/QueryBuilder+Group.swift

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -25,52 +25,52 @@ public extension QueryBuilder {
2525
group(by: properties)
2626
}
2727

28-
func group<V: Expression>(by keyPath: KeyPath<Object<M>, V>, name: String, type: NSAttributeDescription.AttributeType) -> QueryBuilder<M, R> {
28+
func group<V: E>(by keyPath: KeyPath<O, V>, name: String, type: NSAttributeDescription.AttributeType) -> QueryBuilder<M, R> {
2929
return group(by: NSExpressionDescription(objectKeyPath: keyPath, name: name, type: type))
3030
}
3131

32-
func group<V: Expression>(by keyPath: KeyPath<Object<M>, V>) -> QueryBuilder<M, R> {
33-
let object = Object<M>()
32+
func group<V: E>(by keyPath: KeyPath<O, V>) -> QueryBuilder<M, R> {
33+
let object = O()
3434
let expression = object[keyPath: keyPath]
3535
return group(by: "\(expression.pqiExpression)")
3636
}
3737

38-
func group<V1: Expression, V2: Expression>(
39-
by keyPath1: KeyPath<Object<M>, V1>,
40-
_ keyPath2: KeyPath<Object<M>, V2>
38+
func group<V1: E, V2: E>(
39+
by keyPath1: KeyPath<O, V1>,
40+
_ keyPath2: KeyPath<O, V2>
4141
) -> QueryBuilder<M, R> {
4242
group(by: keyPath1)
4343
.group(by: keyPath2)
4444
}
4545

46-
func group<V1: Expression, V2: Expression, V3: Expression>(
47-
by keyPath1: KeyPath<Object<M>, V1>,
48-
_ keyPath2: KeyPath<Object<M>, V2>,
49-
_ keyPath3: KeyPath<Object<M>, V3>
46+
func group<V1: E, V2: E, V3: E>(
47+
by keyPath1: KeyPath<O, V1>,
48+
_ keyPath2: KeyPath<O, V2>,
49+
_ keyPath3: KeyPath<O, V3>
5050
) -> QueryBuilder<M, R> {
5151
group(by: keyPath1)
5252
.group(by: keyPath2)
5353
.group(by: keyPath3)
5454
}
5555

56-
func group<V1: Expression, V2: Expression, V3: Expression, V4: Expression>(
57-
by keyPath1: KeyPath<Object<M>, V1>,
58-
_ keyPath2: KeyPath<Object<M>, V2>,
59-
_ keyPath3: KeyPath<Object<M>, V3>,
60-
_ keyPath4: KeyPath<Object<M>, V4>
56+
func group<V1: E, V2: E, V3: E, V4: E>(
57+
by keyPath1: KeyPath<O, V1>,
58+
_ keyPath2: KeyPath<O, V2>,
59+
_ keyPath3: KeyPath<O, V3>,
60+
_ keyPath4: KeyPath<O, V4>
6161
) -> QueryBuilder<M, R> {
6262
group(by: keyPath1)
6363
.group(by: keyPath2)
6464
.group(by: keyPath3)
6565
.group(by: keyPath4)
6666
}
6767

68-
func group<V1: Expression, V2: Expression, V3: Expression, V4: Expression, V5: Expression>(
69-
by keyPath1: KeyPath<Object<M>, V1>,
70-
_ keyPath2: KeyPath<Object<M>, V2>,
71-
_ keyPath3: KeyPath<Object<M>, V3>,
72-
_ keyPath4: KeyPath<Object<M>, V4>,
73-
_ keyPath5: KeyPath<Object<M>, V5>
68+
func group<V1: E, V2: E, V3: E, V4: E, V5: E>(
69+
by keyPath1: KeyPath<O, V1>,
70+
_ keyPath2: KeyPath<O, V2>,
71+
_ keyPath3: KeyPath<O, V3>,
72+
_ keyPath4: KeyPath<O, V4>,
73+
_ keyPath5: KeyPath<O, V5>
7474
) -> QueryBuilder<M, R> {
7575
group(by: keyPath1)
7676
.group(by: keyPath2)
@@ -79,13 +79,13 @@ public extension QueryBuilder {
7979
.group(by: keyPath5)
8080
}
8181

82-
func group<V1: Expression, V2: Expression, V3: Expression, V4: Expression, V5: Expression, V6: Expression>(
83-
by keyPath1: KeyPath<Object<M>, V1>,
84-
_ keyPath2: KeyPath<Object<M>, V2>,
85-
_ keyPath3: KeyPath<Object<M>, V3>,
86-
_ keyPath4: KeyPath<Object<M>, V4>,
87-
_ keyPath5: KeyPath<Object<M>, V5>,
88-
_ keyPath6: KeyPath<Object<M>, V6>
82+
func group<V1: E, V2: E, V3: E, V4: E, V5: E, V6: E>(
83+
by keyPath1: KeyPath<O, V1>,
84+
_ keyPath2: KeyPath<O, V2>,
85+
_ keyPath3: KeyPath<O, V3>,
86+
_ keyPath4: KeyPath<O, V4>,
87+
_ keyPath5: KeyPath<O, V5>,
88+
_ keyPath6: KeyPath<O, V6>
8989
) -> QueryBuilder<M, R> {
9090
group(by: keyPath1)
9191
.group(by: keyPath2)
@@ -95,14 +95,14 @@ public extension QueryBuilder {
9595
.group(by: keyPath6)
9696
}
9797

98-
func group<V1: Expression, V2: Expression, V3: Expression, V4: Expression, V5: Expression, V6: Expression, V7: Expression>(
99-
by keyPath1: KeyPath<Object<M>, V1>,
100-
_ keyPath2: KeyPath<Object<M>, V2>,
101-
_ keyPath3: KeyPath<Object<M>, V3>,
102-
_ keyPath4: KeyPath<Object<M>, V4>,
103-
_ keyPath5: KeyPath<Object<M>, V5>,
104-
_ keyPath6: KeyPath<Object<M>, V6>,
105-
_ keyPath7: KeyPath<Object<M>, V7>
98+
func group<V1: E, V2: E, V3: E, V4: E, V5: E, V6: E, V7: E>(
99+
by keyPath1: KeyPath<O, V1>,
100+
_ keyPath2: KeyPath<O, V2>,
101+
_ keyPath3: KeyPath<O, V3>,
102+
_ keyPath4: KeyPath<O, V4>,
103+
_ keyPath5: KeyPath<O, V5>,
104+
_ keyPath6: KeyPath<O, V6>,
105+
_ keyPath7: KeyPath<O, V7>
106106
) -> QueryBuilder<M, R> {
107107
group(by: keyPath1)
108108
.group(by: keyPath2)

Sources/CoreDataQueryInterface/QueryBuilder+Group.swift.gyb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ public extension QueryBuilder {
3030
group(by: properties)
3131
}
3232

33-
func group<V: Expression>(by keyPath: KeyPath<Object<M>, V>, name: String, type: NSAttributeDescription.AttributeType) -> QueryBuilder<M, R> {
33+
func group<V: E>(by keyPath: KeyPath<O, V>, name: String, type: NSAttributeDescription.AttributeType) -> QueryBuilder<M, R> {
3434
return group(by: NSExpressionDescription(objectKeyPath: keyPath, name: name, type: type))
3535
}
3636

37-
func group<V: Expression>(by keyPath: KeyPath<Object<M>, V>) -> QueryBuilder<M, R> {
38-
let object = Object<M>()
37+
func group<V: E>(by keyPath: KeyPath<O, V>) -> QueryBuilder<M, R> {
38+
let object = O()
3939
let expression = object[keyPath: keyPath]
4040
return group(by: "\(expression.pqiExpression)")
4141
}
4242
% for i in range(2, 8):
4343

44-
func group<${args(range(1, i + 1), lambda i: f'V{i}: Expression')}>(
45-
by ${args(range(1, i + 1), lambda i: f'keyPath{i}: KeyPath<Object<M>, V{i}>', ',\n _ ')}
44+
func group<${args(range(1, i + 1), lambda i: f'V{i}: E')}>(
45+
by ${args(range(1, i + 1), lambda i: f'keyPath{i}: KeyPath<O, V{i}>', ',\n _ ')}
4646
) -> QueryBuilder<M, R> {
4747
group(by: keyPath1)
4848
% for k in range(2, i + 1):

Sources/CoreDataQueryInterface/QueryBuilder+Order.swift

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ public extension QueryBuilder {
2727
order(by: sortDescriptors)
2828
}
2929

30-
func order<V: Expression>(_ direction: SortDirection = .ascending, by keyPath: KeyPath<Object<M>, V>) -> QueryBuilder<M, R> {
30+
func order<V: E>(_ direction: SortDirection = .ascending, by keyPath: KeyPath<O, V>) -> QueryBuilder<M, R> {
3131
order(by: .init(objectKeyPath: keyPath, ascending: direction.isAscending))
3232
}
3333

34-
func order<V1: Expression, V2: Expression>(
34+
func order<V1: E, V2: E>(
3535
_ direction: SortDirection = .ascending,
36-
by keyPath1: KeyPath<Object<M>, V1>,
37-
_ keyPath2: KeyPath<Object<M>, V2>
36+
by keyPath1: KeyPath<O, V1>,
37+
_ keyPath2: KeyPath<O, V2>
3838
) -> QueryBuilder<M, R> {
3939
let sortDescriptors = [
4040
NSSortDescriptor(objectKeyPath: keyPath1, ascending: direction.isAscending),
@@ -43,11 +43,11 @@ public extension QueryBuilder {
4343
return order(by: sortDescriptors)
4444
}
4545

46-
func order<V1: Expression, V2: Expression, V3: Expression>(
46+
func order<V1: E, V2: E, V3: E>(
4747
_ direction: SortDirection = .ascending,
48-
by keyPath1: KeyPath<Object<M>, V1>,
49-
_ keyPath2: KeyPath<Object<M>, V2>,
50-
_ keyPath3: KeyPath<Object<M>, V3>
48+
by keyPath1: KeyPath<O, V1>,
49+
_ keyPath2: KeyPath<O, V2>,
50+
_ keyPath3: KeyPath<O, V3>
5151
) -> QueryBuilder<M, R> {
5252
let sortDescriptors = [
5353
NSSortDescriptor(objectKeyPath: keyPath1, ascending: direction.isAscending),
@@ -57,12 +57,12 @@ public extension QueryBuilder {
5757
return order(by: sortDescriptors)
5858
}
5959

60-
func order<V1: Expression, V2: Expression, V3: Expression, V4: Expression>(
60+
func order<V1: E, V2: E, V3: E, V4: E>(
6161
_ direction: SortDirection = .ascending,
62-
by keyPath1: KeyPath<Object<M>, V1>,
63-
_ keyPath2: KeyPath<Object<M>, V2>,
64-
_ keyPath3: KeyPath<Object<M>, V3>,
65-
_ keyPath4: KeyPath<Object<M>, V4>
62+
by keyPath1: KeyPath<O, V1>,
63+
_ keyPath2: KeyPath<O, V2>,
64+
_ keyPath3: KeyPath<O, V3>,
65+
_ keyPath4: KeyPath<O, V4>
6666
) -> QueryBuilder<M, R> {
6767
let sortDescriptors = [
6868
NSSortDescriptor(objectKeyPath: keyPath1, ascending: direction.isAscending),
@@ -73,13 +73,13 @@ public extension QueryBuilder {
7373
return order(by: sortDescriptors)
7474
}
7575

76-
func order<V1: Expression, V2: Expression, V3: Expression, V4: Expression, V5: Expression>(
76+
func order<V1: E, V2: E, V3: E, V4: E, V5: E>(
7777
_ direction: SortDirection = .ascending,
78-
by keyPath1: KeyPath<Object<M>, V1>,
79-
_ keyPath2: KeyPath<Object<M>, V2>,
80-
_ keyPath3: KeyPath<Object<M>, V3>,
81-
_ keyPath4: KeyPath<Object<M>, V4>,
82-
_ keyPath5: KeyPath<Object<M>, V5>
78+
by keyPath1: KeyPath<O, V1>,
79+
_ keyPath2: KeyPath<O, V2>,
80+
_ keyPath3: KeyPath<O, V3>,
81+
_ keyPath4: KeyPath<O, V4>,
82+
_ keyPath5: KeyPath<O, V5>
8383
) -> QueryBuilder<M, R> {
8484
let sortDescriptors = [
8585
NSSortDescriptor(objectKeyPath: keyPath1, ascending: direction.isAscending),
@@ -91,14 +91,14 @@ public extension QueryBuilder {
9191
return order(by: sortDescriptors)
9292
}
9393

94-
func order<V1: Expression, V2: Expression, V3: Expression, V4: Expression, V5: Expression, V6: Expression>(
94+
func order<V1: E, V2: E, V3: E, V4: E, V5: E, V6: E>(
9595
_ direction: SortDirection = .ascending,
96-
by keyPath1: KeyPath<Object<M>, V1>,
97-
_ keyPath2: KeyPath<Object<M>, V2>,
98-
_ keyPath3: KeyPath<Object<M>, V3>,
99-
_ keyPath4: KeyPath<Object<M>, V4>,
100-
_ keyPath5: KeyPath<Object<M>, V5>,
101-
_ keyPath6: KeyPath<Object<M>, V6>
96+
by keyPath1: KeyPath<O, V1>,
97+
_ keyPath2: KeyPath<O, V2>,
98+
_ keyPath3: KeyPath<O, V3>,
99+
_ keyPath4: KeyPath<O, V4>,
100+
_ keyPath5: KeyPath<O, V5>,
101+
_ keyPath6: KeyPath<O, V6>
102102
) -> QueryBuilder<M, R> {
103103
let sortDescriptors = [
104104
NSSortDescriptor(objectKeyPath: keyPath1, ascending: direction.isAscending),
@@ -111,15 +111,15 @@ public extension QueryBuilder {
111111
return order(by: sortDescriptors)
112112
}
113113

114-
func order<V1: Expression, V2: Expression, V3: Expression, V4: Expression, V5: Expression, V6: Expression, V7: Expression>(
114+
func order<V1: E, V2: E, V3: E, V4: E, V5: E, V6: E, V7: E>(
115115
_ direction: SortDirection = .ascending,
116-
by keyPath1: KeyPath<Object<M>, V1>,
117-
_ keyPath2: KeyPath<Object<M>, V2>,
118-
_ keyPath3: KeyPath<Object<M>, V3>,
119-
_ keyPath4: KeyPath<Object<M>, V4>,
120-
_ keyPath5: KeyPath<Object<M>, V5>,
121-
_ keyPath6: KeyPath<Object<M>, V6>,
122-
_ keyPath7: KeyPath<Object<M>, V7>
116+
by keyPath1: KeyPath<O, V1>,
117+
_ keyPath2: KeyPath<O, V2>,
118+
_ keyPath3: KeyPath<O, V3>,
119+
_ keyPath4: KeyPath<O, V4>,
120+
_ keyPath5: KeyPath<O, V5>,
121+
_ keyPath6: KeyPath<O, V6>,
122+
_ keyPath7: KeyPath<O, V7>
123123
) -> QueryBuilder<M, R> {
124124
let sortDescriptors = [
125125
NSSortDescriptor(objectKeyPath: keyPath1, ascending: direction.isAscending),

Sources/CoreDataQueryInterface/QueryBuilder+Order.swift.gyb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ public extension QueryBuilder {
3232
order(by: sortDescriptors)
3333
}
3434

35-
func order<V: Expression>(_ direction: SortDirection = .ascending, by keyPath: KeyPath<Object<M>, V>) -> QueryBuilder<M, R> {
35+
func order<V: E>(_ direction: SortDirection = .ascending, by keyPath: KeyPath<O, V>) -> QueryBuilder<M, R> {
3636
order(by: .init(objectKeyPath: keyPath, ascending: direction.isAscending))
3737
}
3838
% for i in range(2, 8):
3939

40-
func order<${args(range(1, i + 1), lambda i: f'V{i}: Expression')}>(
40+
func order<${args(range(1, i + 1), lambda i: f'V{i}: E')}>(
4141
_ direction: SortDirection = .ascending,
42-
by ${args(range(1, i + 1), lambda i: f'keyPath{i}: KeyPath<Object<M>, V{i}>', ',\n _ ')}
42+
by ${args(range(1, i + 1), lambda i: f'keyPath{i}: KeyPath<O, V{i}>', ',\n _ ')}
4343
) -> QueryBuilder<M, R> {
4444
let sortDescriptors = [
4545
% for k in range(1, i + 1):

Sources/CoreDataQueryInterface/QueryBuilder+Select.swift

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -32,52 +32,52 @@ public extension QueryBuilder {
3232
select(properties)
3333
}
3434

35-
func select<V: Expression>(_ keyPath: KeyPath<Object<M>, V>, name: String, type: NSAttributeDescription.AttributeType) -> QueryBuilder<M, R> {
35+
func select<V: E>(_ keyPath: KeyPath<O, V>, name: String, type: NSAttributeDescription.AttributeType) -> QueryBuilder<M, R> {
3636
select(NSExpressionDescription(objectKeyPath: keyPath, name: name, type: type))
3737
}
3838

39-
func select<V: Expression>(_ keyPath: KeyPath<Object<M>, V>) -> QueryBuilder<M, R> {
40-
let object = Object<M>()
39+
func select<V: E>(_ keyPath: KeyPath<O, V>) -> QueryBuilder<M, R> {
40+
let object = O()
4141
let expression = object[keyPath: keyPath]
4242
return select("\(expression.pqiExpression)")
4343
}
4444

45-
func select<V1: Expression, V2: Expression>(
46-
_ keyPath1: KeyPath<Object<M>, V1>,
47-
_ keyPath2: KeyPath<Object<M>, V2>
45+
func select<V1: E, V2: E>(
46+
_ keyPath1: KeyPath<O, V1>,
47+
_ keyPath2: KeyPath<O, V2>
4848
) -> QueryBuilder<M, R> {
4949
select(keyPath1)
5050
.select(keyPath2)
5151
}
5252

53-
func select<V1: Expression, V2: Expression, V3: Expression>(
54-
_ keyPath1: KeyPath<Object<M>, V1>,
55-
_ keyPath2: KeyPath<Object<M>, V2>,
56-
_ keyPath3: KeyPath<Object<M>, V3>
53+
func select<V1: E, V2: E, V3: E>(
54+
_ keyPath1: KeyPath<O, V1>,
55+
_ keyPath2: KeyPath<O, V2>,
56+
_ keyPath3: KeyPath<O, V3>
5757
) -> QueryBuilder<M, R> {
5858
select(keyPath1)
5959
.select(keyPath2)
6060
.select(keyPath3)
6161
}
6262

63-
func select<V1: Expression, V2: Expression, V3: Expression, V4: Expression>(
64-
_ keyPath1: KeyPath<Object<M>, V1>,
65-
_ keyPath2: KeyPath<Object<M>, V2>,
66-
_ keyPath3: KeyPath<Object<M>, V3>,
67-
_ keyPath4: KeyPath<Object<M>, V4>
63+
func select<V1: E, V2: E, V3: E, V4: E>(
64+
_ keyPath1: KeyPath<O, V1>,
65+
_ keyPath2: KeyPath<O, V2>,
66+
_ keyPath3: KeyPath<O, V3>,
67+
_ keyPath4: KeyPath<O, V4>
6868
) -> QueryBuilder<M, R> {
6969
select(keyPath1)
7070
.select(keyPath2)
7171
.select(keyPath3)
7272
.select(keyPath4)
7373
}
7474

75-
func select<V1: Expression, V2: Expression, V3: Expression, V4: Expression, V5: Expression>(
76-
_ keyPath1: KeyPath<Object<M>, V1>,
77-
_ keyPath2: KeyPath<Object<M>, V2>,
78-
_ keyPath3: KeyPath<Object<M>, V3>,
79-
_ keyPath4: KeyPath<Object<M>, V4>,
80-
_ keyPath5: KeyPath<Object<M>, V5>
75+
func select<V1: E, V2: E, V3: E, V4: E, V5: E>(
76+
_ keyPath1: KeyPath<O, V1>,
77+
_ keyPath2: KeyPath<O, V2>,
78+
_ keyPath3: KeyPath<O, V3>,
79+
_ keyPath4: KeyPath<O, V4>,
80+
_ keyPath5: KeyPath<O, V5>
8181
) -> QueryBuilder<M, R> {
8282
select(keyPath1)
8383
.select(keyPath2)
@@ -86,13 +86,13 @@ public extension QueryBuilder {
8686
.select(keyPath5)
8787
}
8888

89-
func select<V1: Expression, V2: Expression, V3: Expression, V4: Expression, V5: Expression, V6: Expression>(
90-
_ keyPath1: KeyPath<Object<M>, V1>,
91-
_ keyPath2: KeyPath<Object<M>, V2>,
92-
_ keyPath3: KeyPath<Object<M>, V3>,
93-
_ keyPath4: KeyPath<Object<M>, V4>,
94-
_ keyPath5: KeyPath<Object<M>, V5>,
95-
_ keyPath6: KeyPath<Object<M>, V6>
89+
func select<V1: E, V2: E, V3: E, V4: E, V5: E, V6: E>(
90+
_ keyPath1: KeyPath<O, V1>,
91+
_ keyPath2: KeyPath<O, V2>,
92+
_ keyPath3: KeyPath<O, V3>,
93+
_ keyPath4: KeyPath<O, V4>,
94+
_ keyPath5: KeyPath<O, V5>,
95+
_ keyPath6: KeyPath<O, V6>
9696
) -> QueryBuilder<M, R> {
9797
select(keyPath1)
9898
.select(keyPath2)
@@ -102,14 +102,14 @@ public extension QueryBuilder {
102102
.select(keyPath6)
103103
}
104104

105-
func select<V1: Expression, V2: Expression, V3: Expression, V4: Expression, V5: Expression, V6: Expression, V7: Expression>(
106-
_ keyPath1: KeyPath<Object<M>, V1>,
107-
_ keyPath2: KeyPath<Object<M>, V2>,
108-
_ keyPath3: KeyPath<Object<M>, V3>,
109-
_ keyPath4: KeyPath<Object<M>, V4>,
110-
_ keyPath5: KeyPath<Object<M>, V5>,
111-
_ keyPath6: KeyPath<Object<M>, V6>,
112-
_ keyPath7: KeyPath<Object<M>, V7>
105+
func select<V1: E, V2: E, V3: E, V4: E, V5: E, V6: E, V7: E>(
106+
_ keyPath1: KeyPath<O, V1>,
107+
_ keyPath2: KeyPath<O, V2>,
108+
_ keyPath3: KeyPath<O, V3>,
109+
_ keyPath4: KeyPath<O, V4>,
110+
_ keyPath5: KeyPath<O, V5>,
111+
_ keyPath6: KeyPath<O, V6>,
112+
_ keyPath7: KeyPath<O, V7>
113113
) -> QueryBuilder<M, R> {
114114
select(keyPath1)
115115
.select(keyPath2)

0 commit comments

Comments
 (0)