Skip to content

Commit fdbab36

Browse files
committedJan 5, 2017
Standardize line breaks on method signatures
I am standardizing the method signatures on long method names or methods that accept predicateFns for prettier "go doc" or "godoc" output based on following rules: 1. first parameter on the same line as method name 2. rest of the parameters are each on a new line 3. return type is at the same line as the last parameter Signed-off-by: Ahmet Alp Balkan <[email protected]>
1 parent 363486a commit fdbab36

11 files changed

+52
-66
lines changed
 

‎aggregate.go

+10-13
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ package linq
1010
// result of f() replaces the previous aggregated value.
1111
//
1212
// Aggregate returns the final result of f().
13-
func (q Query) Aggregate(
14-
f func(interface{}, interface{}) interface{}) interface{} {
13+
func (q Query) Aggregate(f func(interface{}, interface{}) interface{}) interface{} {
1514
next := q.Iterate()
1615

1716
result, any := next()
@@ -32,7 +31,6 @@ func (q Query) Aggregate(
3231
//
3332
// NOTE: Aggregate has better performance than AggregateT.
3433
func (q Query) AggregateT(f interface{}) interface{} {
35-
3634
fGenericFunc, err := newGenericFunc(
3735
"AggregateT", "f", f,
3836
simpleParamValidator(newElemTypeSlice(new(genericType), new(genericType)), newElemTypeSlice(new(genericType))),
@@ -59,10 +57,8 @@ func (q Query) AggregateT(f interface{}) interface{} {
5957
// The result of f() replaces the previous aggregated value.
6058
//
6159
// Aggregate returns the final result of f().
62-
func (q Query) AggregateWithSeed(
63-
seed interface{},
64-
f func(interface{}, interface{}) interface{},
65-
) interface{} {
60+
func (q Query) AggregateWithSeed(seed interface{},
61+
f func(interface{}, interface{}) interface{}) interface{} {
6662

6763
next := q.Iterate()
6864
result := seed
@@ -80,7 +76,8 @@ func (q Query) AggregateWithSeed(
8076
//
8177
// NOTE: AggregateWithSeed has better performance than
8278
// AggregateWithSeedT.
83-
func (q Query) AggregateWithSeedT(seed interface{}, f interface{}) interface{} {
79+
func (q Query) AggregateWithSeedT(seed interface{},
80+
f interface{}) interface{} {
8481
fGenericFunc, err := newGenericFunc(
8582
"AggregateWithSeed", "f", f,
8683
simpleParamValidator(newElemTypeSlice(new(genericType), new(genericType)), newElemTypeSlice(new(genericType))),
@@ -109,11 +106,9 @@ func (q Query) AggregateWithSeedT(seed interface{}, f interface{}) interface{} {
109106
//
110107
// The final result of func is passed to resultSelector to obtain the final
111108
// result of Aggregate.
112-
func (q Query) AggregateWithSeedBy(
113-
seed interface{},
109+
func (q Query) AggregateWithSeedBy(seed interface{},
114110
f func(interface{}, interface{}) interface{},
115-
resultSelector func(interface{}) interface{},
116-
) interface{} {
111+
resultSelector func(interface{}) interface{}) interface{} {
117112

118113
next := q.Iterate()
119114
result := seed
@@ -132,7 +127,9 @@ func (q Query) AggregateWithSeedBy(
132127
//
133128
// NOTE: AggregateWithSeedBy has better performance than
134129
// AggregateWithSeedByT.
135-
func (q Query) AggregateWithSeedByT(seed interface{}, f interface{}, resultSelectorFn interface{}) interface{} {
130+
func (q Query) AggregateWithSeedByT(seed interface{},
131+
f interface{},
132+
resultSelectorFn interface{}) interface{} {
136133
fGenericFunc, err := newGenericFunc(
137134
"AggregateWithSeedByT", "f", f,
138135
simpleParamValidator(newElemTypeSlice(new(genericType), new(genericType)), newElemTypeSlice(new(genericType))),

‎doc.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
// Package linq provides methods for querying and manipulating
2-
// slices, arrays, maps, strings, channels and collections.
3-
//
4-
//
5-
// Authors: Alexander Kalankhodzhaev (kalan), Ahmet Alp Balkan, Cleiton Marques Souza
6-
//
1+
// Package linq provides methods for querying and manipulating slices, arrays,
2+
// maps, strings, channels and collections.
73
//
4+
// Authors: Alexander Kalankhodzhaev (kalan), Ahmet Alp Balkan, Cleiton Marques
5+
// Souza.
86
package linq

‎except.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ func (q Query) Except(q2 Query) Query {
2929
// ExceptBy invokes a transform function on each element of a collection and
3030
// produces the set difference of two sequences. The set difference is the
3131
// members of the first sequence that don't appear in the second sequence.
32-
func (q Query) ExceptBy(
33-
q2 Query, selector func(interface{}) interface{}) Query {
32+
func (q Query) ExceptBy(q2 Query,
33+
selector func(interface{}) interface{}) Query {
3434
return Query{
3535
Iterate: func() Iterator {
3636
next := q.Iterate()
@@ -61,7 +61,8 @@ func (q Query) ExceptBy(
6161
// - selectorFn is of type "func(TSource) TSource"
6262
//
6363
// NOTE: ExceptBy has better performance than ExceptByT.
64-
func (q Query) ExceptByT(q2 Query, selectorFn interface{}) Query {
64+
func (q Query) ExceptByT(q2 Query,
65+
selectorFn interface{}) Query {
6566
selectorGenericFunc, err := newGenericFunc(
6667
"ExceptByT", "selectorFn", selectorFn,
6768
simpleParamValidator(newElemTypeSlice(new(genericType)), newElemTypeSlice(new(genericType))),

‎groupby.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@ type Group struct {
99
// GroupBy method groups the elements of a collection according to a specified
1010
// key selector function and projects the elements for each group by using a
1111
// specified function.
12-
func (q Query) GroupBy(
13-
keySelector func(interface{}) interface{},
14-
elementSelector func(interface{}) interface{},
15-
) Query {
16-
12+
func (q Query) GroupBy(keySelector func(interface{}) interface{},
13+
elementSelector func(interface{}) interface{}) Query {
1714
return Query{
1815
func() Iterator {
1916
next := q.Iterate()
@@ -53,7 +50,8 @@ func (q Query) GroupBy(
5350
// - elementSelectorFn is of type "func(TSource) TElement"
5451
//
5552
// NOTE: GroupBy has better performance than GroupByT.
56-
func (q Query) GroupByT(keySelectorFn interface{}, elementSelectorFn interface{}) Query {
53+
func (q Query) GroupByT(keySelectorFn interface{},
54+
elementSelectorFn interface{}) Query {
5755
keySelectorGenericFunc, err := newGenericFunc(
5856
"GroupByT", "keySelectorFn", keySelectorFn,
5957
simpleParamValidator(newElemTypeSlice(new(genericType)), newElemTypeSlice(new(genericType))),

‎groupjoin.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@ import "reflect"
1818
//
1919
// GroupJoin preserves the order of the elements of outer, and for each element
2020
// of outer, the order of the matching elements from inner.
21-
func (q Query) GroupJoin(
22-
inner Query,
21+
func (q Query) GroupJoin(inner Query,
2322
outerKeySelector func(interface{}) interface{},
2423
innerKeySelector func(interface{}) interface{},
25-
resultSelector func(outer interface{}, inners []interface{}) interface{},
26-
) Query {
24+
resultSelector func(outer interface{}, inners []interface{}) interface{}) Query {
2725

2826
return Query{
2927
Iterate: func() Iterator {
@@ -61,7 +59,10 @@ func (q Query) GroupJoin(
6159
// - resultSelectorFn: is of type "func(TOuter, inners []TInner) TResult"
6260
//
6361
// NOTE: GroupJoin has better performance than GroupJoinT.
64-
func (q Query) GroupJoinT(inner Query, outerKeySelectorFn interface{}, innerKeySelectorFn interface{}, resultSelectorFn interface{}) Query {
62+
func (q Query) GroupJoinT(inner Query,
63+
outerKeySelectorFn interface{},
64+
innerKeySelectorFn interface{},
65+
resultSelectorFn interface{}) Query {
6566
outerKeySelectorGenericFunc, err := newGenericFunc(
6667
"GroupJoinT", "outerKeySelectorFn", outerKeySelectorFn,
6768
simpleParamValidator(newElemTypeSlice(new(genericType)), newElemTypeSlice(new(genericType))),

‎intersect.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@ func (q Query) Intersect(q2 Query) Query {
3535
// other elements.
3636
//
3737
// IntersectBy invokes a transform function on each element of both collections.
38-
func (q Query) IntersectBy(
39-
q2 Query,
40-
selector func(interface{}) interface{},
41-
) Query {
38+
func (q Query) IntersectBy(q2 Query,
39+
selector func(interface{}) interface{}) Query {
4240

4341
return Query{
4442
Iterate: func() Iterator {
@@ -71,7 +69,8 @@ func (q Query) IntersectBy(
7169
// - selectorFn is of type "func(TSource) TSource"
7270
//
7371
// NOTE: IntersectBy has better performance than IntersectByT.
74-
func (q Query) IntersectByT(q2 Query, selectorFn interface{}) Query {
72+
func (q Query) IntersectByT(q2 Query,
73+
selectorFn interface{}) Query {
7574
selectorGenericFunc, err := newGenericFunc(
7675
"IntersectByT", "selectorFn", selectorFn,
7776
simpleParamValidator(newElemTypeSlice(new(genericType)), newElemTypeSlice(new(genericType))),

‎join.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ package linq
1010
//
1111
// Join preserves the order of the elements of outer collection, and for each of
1212
// these elements, the order of the matching elements of inner.
13-
func (q Query) Join(
14-
inner Query,
13+
func (q Query) Join(inner Query,
1514
outerKeySelector func(interface{}) interface{},
1615
innerKeySelector func(interface{}) interface{},
17-
resultSelector func(outer interface{}, inner interface{}) interface{},
18-
) Query {
16+
resultSelector func(outer interface{}, inner interface{}) interface{}) Query {
1917

2018
return Query{
2119
Iterate: func() Iterator {
@@ -65,8 +63,7 @@ func (q Query) Join(
6563
func (q Query) JoinT(inner Query,
6664
outerKeySelectorFn interface{},
6765
innerKeySelectorFn interface{},
68-
resultSelectorFn interface{},
69-
) Query {
66+
resultSelectorFn interface{}) Query {
7067
outerKeySelectorGenericFunc, err := newGenericFunc(
7168
"JoinT", "outerKeySelectorFn", outerKeySelectorFn,
7269
simpleParamValidator(newElemTypeSlice(new(genericType)), newElemTypeSlice(new(genericType))),

‎orderby.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ type OrderedQuery struct {
1818

1919
// OrderBy sorts the elements of a collection in ascending order. Elements are
2020
// sorted according to a key.
21-
func (q Query) OrderBy(
22-
selector func(interface{}) interface{}) OrderedQuery {
21+
func (q Query) OrderBy(selector func(interface{}) interface{}) OrderedQuery {
2322
return OrderedQuery{
2423
orders: []order{{selector: selector}},
2524
original: q,
@@ -66,8 +65,7 @@ func (q Query) OrderByT(selectorFn interface{}) OrderedQuery {
6665

6766
// OrderByDescending sorts the elements of a collection in descending order.
6867
// Elements are sorted according to a key.
69-
func (q Query) OrderByDescending(
70-
selector func(interface{}) interface{}) OrderedQuery {
68+
func (q Query) OrderByDescending(selector func(interface{}) interface{}) OrderedQuery {
7169
return OrderedQuery{
7270
orders: []order{{selector: selector, desc: true}},
7371
original: q,
@@ -160,8 +158,7 @@ func (oq OrderedQuery) ThenByT(selectorFn interface{}) OrderedQuery {
160158
// ThenByDescending performs a subsequent ordering of the elements in a
161159
// collection in descending order. This method enables you to specify multiple
162160
// sort criteria by applying any number of ThenBy or ThenByDescending methods.
163-
func (oq OrderedQuery) ThenByDescending(
164-
selector func(interface{}) interface{}) OrderedQuery {
161+
func (oq OrderedQuery) ThenByDescending(selector func(interface{}) interface{}) OrderedQuery {
165162
return OrderedQuery{
166163
orders: append(oq.orders, order{selector: selector, desc: true}),
167164
original: oq.original,

‎result.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -493,11 +493,9 @@ func (q Query) ToMap(result interface{}) {
493493
// element of the collection to generate key and value for the map. Generated
494494
// key and value types must be assignable to the map's key and value types.
495495
// ToMapBy doesn't empty the result map before populating it.
496-
func (q Query) ToMapBy(
497-
result interface{},
496+
func (q Query) ToMapBy(result interface{},
498497
keySelector func(interface{}) interface{},
499-
valueSelector func(interface{}) interface{},
500-
) {
498+
valueSelector func(interface{}) interface{}) {
501499
res := reflect.ValueOf(result)
502500
m := reflect.Indirect(res)
503501
next := q.Iterate()
@@ -518,7 +516,8 @@ func (q Query) ToMapBy(
518516
// - valueSelectorFn is of type "func(TSource)TValue"
519517
//
520518
// NOTE: ToMapBy has better performance than ToMapByT.
521-
func (q Query) ToMapByT(result interface{}, keySelectorFn interface{}, valueSelectorFn interface{}) {
519+
func (q Query) ToMapByT(result interface{},
520+
keySelectorFn interface{}, valueSelectorFn interface{}) {
522521
keySelectorGenericFunc, err := newGenericFunc(
523522
"ToMapByT", "keySelectorFn", keySelectorFn,
524523
simpleParamValidator(newElemTypeSlice(new(genericType)), newElemTypeSlice(new(genericType))),

‎selectmany.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,8 @@ func (q Query) SelectManyIndexedT(selectorFn interface{}) Query {
120120
// SelectManyBy projects each element of a collection to a Query, iterates and
121121
// flattens the resulting collection into one collection, and invokes a result
122122
// selector function on each element therein.
123-
func (q Query) SelectManyBy(
124-
selector func(interface{}) Query,
125-
resultSelector func(interface{}, interface{}) interface{},
126-
) Query {
123+
func (q Query) SelectManyBy(selector func(interface{}) Query,
124+
resultSelector func(interface{}, interface{}) interface{}) Query {
127125

128126
return Query{
129127
Iterate: func() Iterator {
@@ -161,7 +159,8 @@ func (q Query) SelectManyBy(
161159
// - resultSelectorFn is of type "func(TSource,TCollection)TResult"
162160
//
163161
// NOTE: SelectManyBy has better performance than SelectManyByT.
164-
func (q Query) SelectManyByT(selectorFn interface{}, resultSelectorFn interface{}) Query {
162+
func (q Query) SelectManyByT(selectorFn interface{},
163+
resultSelectorFn interface{}) Query {
165164

166165
selectorGenericFunc, err := newGenericFunc(
167166
"SelectManyByT", "selectorFn", selectorFn,
@@ -236,7 +235,8 @@ func (q Query) SelectManyByIndexed(selector func(int, interface{}) Query,
236235
//
237236
// NOTE: SelectManyByIndexed has better performance than
238237
// SelectManyByIndexedT.
239-
func (q Query) SelectManyByIndexedT(selectorFn interface{}, resultSelectorFn interface{}) Query {
238+
func (q Query) SelectManyByIndexedT(selectorFn interface{},
239+
resultSelectorFn interface{}) Query {
240240
selectorGenericFunc, err := newGenericFunc(
241241
"SelectManyByIndexedT", "selectorFn", selectorFn,
242242
simpleParamValidator(newElemTypeSlice(new(int), new(genericType)), newElemTypeSlice(new(Query))),

‎zip.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ package linq
1010
// combines elements until it reaches the end of one of the collections. For
1111
// example, if one collection has three elements and the other one has four, the
1212
// result collection has only three elements.
13-
func (q Query) Zip(
14-
q2 Query,
15-
resultSelector func(interface{}, interface{}) interface{},
16-
) Query {
13+
func (q Query) Zip(q2 Query,
14+
resultSelector func(interface{}, interface{}) interface{}) Query {
1715

1816
return Query{
1917
Iterate: func() Iterator {
@@ -39,7 +37,8 @@ func (q Query) Zip(
3937
// - resultSelectorFn is of type "func(TFirst,TSecond)TResult"
4038
//
4139
// NOTE: Zip has better performance than ZipT.
42-
func (q Query) ZipT(q2 Query, resultSelectorFn interface{}) Query {
40+
func (q Query) ZipT(q2 Query,
41+
resultSelectorFn interface{}) Query {
4342
resultSelectorGenericFunc, err := newGenericFunc(
4443
"ZipT", "resultSelectorFn", resultSelectorFn,
4544
simpleParamValidator(newElemTypeSlice(new(genericType), new(genericType)), newElemTypeSlice(new(genericType))),

0 commit comments

Comments
 (0)
Please sign in to comment.