@@ -27,38 +27,68 @@ import Foundation
2727
2828extension ExpressionQueryType {
2929
30+ /**
31+ Projection, i.e., select attributes of an entity rather than the entities themselves.
32+
33+ `CustomPropertyConvertible` is implemented by `String`, `Attribute` and `NSPropertyDescription`,
34+ so any of these can be used here.
35+ */
3036 public func select( expressions: [ CustomPropertyConvertible ] ) -> ExpressionQuery < QueryEntityType > {
3137 var builder = self . builder
3238 builder. expressions. appendContentsOf ( expressions)
3339 return ExpressionQuery ( builder: builder)
3440 }
35-
41+
42+ /**
43+ Projection, i.e., select attributes of an entity rather than the entities themselves.
44+
45+ `CustomPropertyConvertible` is implemented by `String`, `Attribute` and `NSPropertyDescription`,
46+ so any of these can be used here.
47+ */
3648 public func select( expressions: CustomPropertyConvertible ... ) -> ExpressionQuery < QueryEntityType > {
3749 return select ( expressions)
3850 }
3951
52+ /**
53+ Projection, i.e., select attributes of an entity rather than the entities themselves.
54+
55+ .select(employee in [employee.firstName, employee.lastName])
56+ */
4057 public func select( expressions: QueryEntityType . EntityAttributeType -> [ CustomPropertyConvertible ] ) -> ExpressionQuery < QueryEntityType > {
4158 let attribute = QueryEntityType . EntityAttributeType ( )
4259 return select ( expressions ( attribute) )
4360 }
44-
61+
62+ /**
63+ Projection, i.e., select attributes of an entity rather than the entities themselves.
64+
65+ .select([{$0.firstName}, {$0.lastName}])
66+ */
4567 public func select( expressions: [ QueryEntityType . EntityAttributeType -> CustomPropertyConvertible ] ) -> ExpressionQuery < QueryEntityType > {
4668 let attribute = QueryEntityType . EntityAttributeType ( )
4769 return select ( expressions. map ( ) { $0 ( attribute) } )
4870 }
49-
71+
72+ /**
73+ Projection, i.e., select attributes of an entity rather than the entities themselves.
74+
75+ .select({$0.firstName}, {$0.lastName})
76+ */
5077 public func select( expressions: ( QueryEntityType . EntityAttributeType -> CustomPropertyConvertible ) ... ) -> ExpressionQuery < QueryEntityType > {
5178 return select ( expressions)
5279 }
5380
81+ /**
82+ Return only the distinct attributes requested in the fetch.
83+ */
5484 public func distinct( ) -> ExpressionQuery < QueryEntityType > {
5585 var builder = self . builder
5686 builder. returnsDistinctResults = true
5787 return ExpressionQuery ( builder: builder)
5888 }
5989
6090 /**
61- Resets the list of selected expressions
91+ Resets the list of selected expressions
6292 */
6393 public func reselect( ) -> ExpressionQuery < QueryEntityType > {
6494 var builder = self . builder
0 commit comments