Skip to content

Commit aba01b9

Browse files
committed
Fixed driver not passing golint
1 parent 98a7f60 commit aba01b9

11 files changed

+235
-189
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ In an attempt to make this library more "idiomatic" some functions have been ren
2121
- Renamed `Js` to `JS`
2222
- Renamed `Json` to `JSON`
2323
- Renamed `Http` to `HTTP`
24+
- Renamed `GeoJson` to `GeoJSON`
25+
- Renamed `ToGeoJson` to `ToGeoJSON`
2426

2527
## v0.7.2 - 2015-05-05
2628
### Added

query_geospatial.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
p "github.com/dancannon/gorethink/ql2"
55
)
66

7-
// CircleOpts describes the optional arguments for a Circle operation
7+
// CircleOpts contains the optional arguments for the Circle term.
88
type CircleOpts struct {
99
NumVertices interface{} `gorethink:"num_vertices,omitempty"`
1010
GeoSystem interface{} `gorethink:"geo_system,omitempty"`
@@ -28,7 +28,7 @@ func Circle(point, radius interface{}, optArgs ...CircleOpts) Term {
2828
return constructRootTerm("Circle", p.Term_CIRCLE, []interface{}{point, radius}, opts)
2929
}
3030

31-
// DistanceOpts describes the optional arguments for a Distance operation
31+
// DistanceOpts contains the optional arguments for the Distance term.
3232
type DistanceOpts struct {
3333
GeoSystem interface{} `gorethink:"geo_system,omitempty"`
3434
Unit interface{} `gorethink:"unit,omitempty"`
@@ -67,17 +67,17 @@ func (t Term) Fill() Term {
6767
return constructMethodTerm(t, "Fill", p.Term_FILL, []interface{}{}, map[string]interface{}{})
6868
}
6969

70-
// Geojson converts a GeoJSON object to a ReQL geometry object.
71-
func Geojson(args ...interface{}) Term {
72-
return constructRootTerm("Geojson", p.Term_GEOJSON, args, map[string]interface{}{})
70+
// GeoJSON converts a GeoJSON object to a ReQL geometry object.
71+
func GeoJSON(args ...interface{}) Term {
72+
return constructRootTerm("GeoJSON", p.Term_GEOJSON, args, map[string]interface{}{})
7373
}
7474

75-
// ToGeojson converts a ReQL geometry object to a GeoJSON object.
76-
func (t Term) ToGeojson(args ...interface{}) Term {
77-
return constructMethodTerm(t, "ToGeojson", p.Term_TO_GEOJSON, args, map[string]interface{}{})
75+
// ToGeoJSON converts a ReQL geometry object to a GeoJSON object.
76+
func (t Term) ToGeoJSON(args ...interface{}) Term {
77+
return constructMethodTerm(t, "ToGeoJSON", p.Term_TO_GEOJSON, args, map[string]interface{}{})
7878
}
7979

80-
// GetIntersectingOpts describes the optional arguments for a GetIntersecting operation
80+
// GetIntersectingOpts contains the optional arguments for the GetIntersecting term.
8181
type GetIntersectingOpts struct {
8282
Index interface{} `gorethink:"index,omitempty"`
8383
}
@@ -97,7 +97,7 @@ func (t Term) GetIntersecting(args interface{}, optArgs ...GetIntersectingOpts)
9797
return constructMethodTerm(t, "GetIntersecting", p.Term_GET_INTERSECTING, []interface{}{args}, opts)
9898
}
9999

100-
// GetIntersectingOpts describes the optional arguments for a GetIntersecting operation
100+
// GetNearestOpts contains the optional arguments for the GetNearest term.
101101
type GetNearestOpts struct {
102102
Index interface{} `gorethink:"index,omitempty"`
103103
MaxResults interface{} `gorethink:"max_results,omitempty"`

query_join.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
p "github.com/dancannon/gorethink/ql2"
55
)
66

7-
// Returns the inner product of two sequences (e.g. a table, a filter result)
7+
// InnerJoin returns the inner product of two sequences (e.g. a table, a filter result)
88
// filtered by the predicate. The query compares each row of the left sequence
99
// with each row of the right sequence to find all pairs of rows which satisfy
1010
// the predicate. When the predicate is satisfied, each matched pair of rows
@@ -13,12 +13,13 @@ func (t Term) InnerJoin(args ...interface{}) Term {
1313
return constructMethodTerm(t, "InnerJoin", p.Term_INNER_JOIN, args, map[string]interface{}{})
1414
}
1515

16-
// Computes a left outer join by retaining each row in the left table even if no
17-
// match was found in the right table.
16+
// OuterJoin computes a left outer join by retaining each row in the left table even
17+
// if no match was found in the right table.
1818
func (t Term) OuterJoin(args ...interface{}) Term {
1919
return constructMethodTerm(t, "OuterJoin", p.Term_OUTER_JOIN, args, map[string]interface{}{})
2020
}
2121

22+
// EqJoinOpts contains the optional arguments for the EqJoin term.
2223
type EqJoinOpts struct {
2324
Index interface{} `gorethink:"index,omitempty"`
2425
}
@@ -27,7 +28,7 @@ func (o *EqJoinOpts) toMap() map[string]interface{} {
2728
return optArgsToMap(o)
2829
}
2930

30-
// An efficient join that looks up elements in the right table by primary key.
31+
// EqJoin is an efficient join that looks up elements in the right table by primary key.
3132
//
3233
// Optional arguments: "index" (string - name of the index to use in right table instead of the primary key)
3334
func (t Term) EqJoin(left, right interface{}, optArgs ...EqJoinOpts) Term {
@@ -38,7 +39,7 @@ func (t Term) EqJoin(left, right interface{}, optArgs ...EqJoinOpts) Term {
3839
return constructMethodTerm(t, "EqJoin", p.Term_EQ_JOIN, []interface{}{funcWrap(left), right}, opts)
3940
}
4041

41-
// Used to 'zip' up the result of a join by merging the 'right' fields into 'left'
42+
// Zip is used to 'zip' up the result of a join by merging the 'right' fields into 'left'
4243
// fields of each member of the sequence.
4344
func (t Term) Zip(args ...interface{}) Term {
4445
return constructMethodTerm(t, "Zip", p.Term_ZIP, args, map[string]interface{}{})

query_manipulation.go

+22-20
Original file line numberDiff line numberDiff line change
@@ -4,108 +4,110 @@ import (
44
p "github.com/dancannon/gorethink/ql2"
55
)
66

7-
// Returns the currently visited document.
7+
// Row returns the currently visited document.
88
var Row = constructRootTerm("Doc", p.Term_IMPLICIT_VAR, []interface{}{}, map[string]interface{}{})
99

10+
// Literal replaces an object in a field instead of merging it with an existing
11+
// object in a merge or update operation.
1012
func Literal(args ...interface{}) Term {
1113
return constructRootTerm("Literal", p.Term_LITERAL, args, map[string]interface{}{})
1214
}
1315

14-
// Get a single field from an object. If called on a sequence, gets that field
16+
// Field gets a single field from an object. If called on a sequence, gets that field
1517
// from every object in the sequence, skipping objects that lack it.
1618
func (t Term) Field(args ...interface{}) Term {
1719
return constructMethodTerm(t, "Field", p.Term_GET_FIELD, args, map[string]interface{}{})
1820
}
1921

20-
// Test if an object has all of the specified fields. An object has a field if
22+
// HasFields tests if an object has all of the specified fields. An object has a field if
2123
// it has the specified key and that key maps to a non-null value. For instance,
2224
// the object `{'a':1,'b':2,'c':null}` has the fields `a` and `b`.
2325
func (t Term) HasFields(args ...interface{}) Term {
2426
return constructMethodTerm(t, "HasFields", p.Term_HAS_FIELDS, args, map[string]interface{}{})
2527
}
2628

27-
// Plucks out one or more attributes from either an object or a sequence of
29+
// Pluck plucks out one or more attributes from either an object or a sequence of
2830
// objects (projection).
2931
func (t Term) Pluck(args ...interface{}) Term {
3032
return constructMethodTerm(t, "Pluck", p.Term_PLUCK, args, map[string]interface{}{})
3133
}
3234

33-
// The opposite of pluck; takes an object or a sequence of objects, and returns
35+
// Without is the opposite of pluck; takes an object or a sequence of objects, and returns
3436
// them with the specified paths removed.
3537
func (t Term) Without(args ...interface{}) Term {
3638
return constructMethodTerm(t, "Without", p.Term_WITHOUT, args, map[string]interface{}{})
3739
}
3840

39-
// Merge two objects together to construct a new object with properties from both.
41+
// Merge merges two objects together to construct a new object with properties from both.
4042
// Gives preference to attributes from other when there is a conflict.
4143
func (t Term) Merge(args ...interface{}) Term {
4244
return constructMethodTerm(t, "Merge", p.Term_MERGE, funcWrapArgs(args), map[string]interface{}{})
4345
}
4446

45-
// Append a value to an array.
47+
// Append appends a value to an array.
4648
func (t Term) Append(args ...interface{}) Term {
4749
return constructMethodTerm(t, "Append", p.Term_APPEND, args, map[string]interface{}{})
4850
}
4951

50-
// Prepend a value to an array.
52+
// Prepend prepends a value to an array.
5153
func (t Term) Prepend(args ...interface{}) Term {
5254
return constructMethodTerm(t, "Prepend", p.Term_PREPEND, args, map[string]interface{}{})
5355
}
5456

55-
// Remove the elements of one array from another array.
57+
// Difference removes the elements of one array from another array.
5658
func (t Term) Difference(args ...interface{}) Term {
5759
return constructMethodTerm(t, "Difference", p.Term_DIFFERENCE, args, map[string]interface{}{})
5860
}
5961

60-
// Add a value to an array and return it as a set (an array with distinct values).
62+
// SetInsert adds a value to an array and return it as a set (an array with distinct values).
6163
func (t Term) SetInsert(args ...interface{}) Term {
6264
return constructMethodTerm(t, "SetInsert", p.Term_SET_INSERT, args, map[string]interface{}{})
6365
}
6466

65-
// Add a several values to an array and return it as a set (an array with
67+
// SetUnion adds several values to an array and return it as a set (an array with
6668
// distinct values).
6769
func (t Term) SetUnion(args ...interface{}) Term {
6870
return constructMethodTerm(t, "SetUnion", p.Term_SET_UNION, args, map[string]interface{}{})
6971
}
7072

71-
// Intersect two arrays returning values that occur in both of them as a set (an
72-
// array with distinct values).
73+
// SetIntersection calculates the intersection of two arrays returning values that
74+
// occur in both of them as a set (an array with distinct values).
7375
func (t Term) SetIntersection(args ...interface{}) Term {
7476
return constructMethodTerm(t, "SetIntersection", p.Term_SET_INTERSECTION, args, map[string]interface{}{})
7577
}
7678

77-
// Remove the elements of one array from another and return them as a set (an
79+
// SetDifference removes the elements of one array from another and return them as a set (an
7880
// array with distinct values).
7981
func (t Term) SetDifference(args ...interface{}) Term {
8082
return constructMethodTerm(t, "SetDifference", p.Term_SET_DIFFERENCE, args, map[string]interface{}{})
8183
}
8284

83-
// Insert a value in to an array at a given index. Returns the modified array.
85+
// InsertAt inserts a value in to an array at a given index. Returns the modified array.
8486
func (t Term) InsertAt(args ...interface{}) Term {
8587
return constructMethodTerm(t, "InsertAt", p.Term_INSERT_AT, args, map[string]interface{}{})
8688
}
8789

88-
// Insert several values in to an array at a given index. Returns the modified array.
90+
// SpliceAt inserts several values in to an array at a given index. Returns the modified array.
8991
func (t Term) SpliceAt(args ...interface{}) Term {
9092
return constructMethodTerm(t, "SpliceAt", p.Term_SPLICE_AT, args, map[string]interface{}{})
9193
}
9294

93-
// Remove an element from an array at a given index. Returns the modified array.
95+
// DeleteAt removes an element from an array at a given index. Returns the modified array.
9496
func (t Term) DeleteAt(args ...interface{}) Term {
9597
return constructMethodTerm(t, "DeleteAt", p.Term_DELETE_AT, args, map[string]interface{}{})
9698
}
9799

98-
// Change a value in an array at a given index. Returns the modified array.
100+
// ChangeAt changes a value in an array at a given index. Returns the modified array.
99101
func (t Term) ChangeAt(args ...interface{}) Term {
100102
return constructMethodTerm(t, "ChangeAt", p.Term_CHANGE_AT, args, map[string]interface{}{})
101103
}
102104

103-
// Return an array containing all of the object's keys.
105+
// Keys returns an array containing all of the object's keys.
104106
func (t Term) Keys(args ...interface{}) Term {
105107
return constructMethodTerm(t, "Keys", p.Term_KEYS, args, map[string]interface{}{})
106108
}
107109

108-
// Creates an object from a list of key-value pairs, where the keys must be strings.
110+
// Object creates an object from a list of key-value pairs, where the keys must be strings.
109111
func Object(args ...interface{}) Term {
110112
return constructRootTerm("Object", p.Term_OBJECT, args, map[string]interface{}{})
111113
}

query_math.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ func Not(args ...interface{}) Term {
151151
return constructRootTerm("Not", p.Term_NOT, args, map[string]interface{}{})
152152
}
153153

154+
// RandomOpts contains the optional arguments for the Random term.
154155
type RandomOpts struct {
155156
Float interface{} `gorethink:"float,omitempty"`
156157
}
@@ -159,8 +160,8 @@ func (o *RandomOpts) toMap() map[string]interface{} {
159160
return optArgsToMap(o)
160161
}
161162

162-
// Generate a random number between the given bounds. If no arguments are
163-
// given, the result will be a floating-point number in the range [0,1).
163+
// Random generates a random number between the given bounds. If no arguments
164+
// are given, the result will be a floating-point number in the range [0,1).
164165
//
165166
// When passing a single argument, r.random(x), the result will be in the
166167
// range [0,x), and when passing two arguments, r.random(x,y), the range is

query_select.go

+38-19
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ func DB(args ...interface{}) Term {
99
return constructRootTerm("DB", p.Term_DB, args, map[string]interface{}{})
1010
}
1111

12+
// TableOpts contains the optional arguments for the Table term
1213
type TableOpts struct {
1314
UseOutdated interface{} `gorethink:"use_outdated,omitempty"`
1415
IdentifierFormat interface{} `gorethink:"identifier_format,omitempty"`
@@ -18,11 +19,16 @@ func (o *TableOpts) toMap() map[string]interface{} {
1819
return optArgsToMap(o)
1920
}
2021

21-
// Select all documents in a table. This command can be chained with other
22-
// commands to do further processing on the data.
22+
// Table selects all documents in a table. This command can be chained with
23+
// other commands to do further processing on the data.
2324
//
24-
// Optional arguments (see http://www.rethinkdb.com/api/#js:selecting_data-table for more information):
25-
// "use_outdated" (boolean - defaults to false)
25+
// There are two optional arguments.
26+
// - useOutdated: if true, this allows potentially out-of-date data to be
27+
// returned, with potentially faster reads. It also allows you to perform reads
28+
// from a secondary replica if a primary has failed. Default false.
29+
// - identifierFormat: possible values are name and uuid, with a default of name.
30+
// If set to uuid, then system tables will refer to servers, databases and tables
31+
// by UUID rather than name. (This only has an effect when used with system tables.)
2632
func Table(name interface{}, optArgs ...TableOpts) Term {
2733
opts := map[string]interface{}{}
2834
if len(optArgs) >= 1 {
@@ -31,11 +37,16 @@ func Table(name interface{}, optArgs ...TableOpts) Term {
3137
return constructRootTerm("Table", p.Term_TABLE, []interface{}{name}, opts)
3238
}
3339

34-
// Select all documents in a table. This command can be chained with other
35-
// commands to do further processing on the data.
40+
// Table selects all documents in a table. This command can be chained with
41+
// other commands to do further processing on the data.
3642
//
37-
// Optional arguments (see http://www.rethinkdb.com/api/#js:selecting_data-table for more information):
38-
// "use_outdated" (boolean - defaults to false)
43+
// There are two optional arguments.
44+
// - useOutdated: if true, this allows potentially out-of-date data to be
45+
// returned, with potentially faster reads. It also allows you to perform reads
46+
// from a secondary replica if a primary has failed. Default false.
47+
// - identifierFormat: possible values are name and uuid, with a default of name.
48+
// If set to uuid, then system tables will refer to servers, databases and tables
49+
// by UUID rather than name. (This only has an effect when used with system tables.)
3950
func (t Term) Table(name interface{}, optArgs ...TableOpts) Term {
4051
opts := map[string]interface{}{}
4152
if len(optArgs) >= 1 {
@@ -44,21 +55,23 @@ func (t Term) Table(name interface{}, optArgs ...TableOpts) Term {
4455
return constructMethodTerm(t, "Table", p.Term_TABLE, []interface{}{name}, opts)
4556
}
4657

47-
// Get a document by primary key. If nothing was found, RethinkDB will return a nil value.
58+
// Get gets a document by primary key. If nothing was found, RethinkDB will return a nil value.
4859
func (t Term) Get(args ...interface{}) Term {
4960
return constructMethodTerm(t, "Get", p.Term_GET, args, map[string]interface{}{})
5061
}
5162

52-
// Get all documents where the given value matches the value of the primary index.
63+
// GetAll gets all documents where the given value matches the value of the primary index.
5364
func (t Term) GetAll(keys ...interface{}) Term {
5465
return constructMethodTerm(t, "GetAll", p.Term_GET_ALL, keys, map[string]interface{}{})
5566
}
5667

57-
// Get all documents where the given value matches the value of the requested index.
68+
// GetAllByIndex gets all documents where the given value matches the value of
69+
// the requested index.
5870
func (t Term) GetAllByIndex(index interface{}, keys ...interface{}) Term {
5971
return constructMethodTerm(t, "GetAll", p.Term_GET_ALL, keys, map[string]interface{}{"index": index})
6072
}
6173

74+
// BetweenOpts contains the optional arguments for the Between term
6275
type BetweenOpts struct {
6376
Index interface{} `gorethink:"index,omitempty"`
6477
LeftBound interface{} `gorethink:"left_bound,omitempty"`
@@ -69,13 +82,18 @@ func (o *BetweenOpts) toMap() map[string]interface{} {
6982
return optArgsToMap(o)
7083
}
7184

72-
// Get all documents between two keys. Accepts three optional arguments: `index`,
73-
// `left_bound`, and `right_bound`. If `index` is set to the name of a secondary
74-
// index, `between` will return all documents where that index's value is in the
75-
// specified range (it uses the primary key by default). `left_bound` or
76-
// `right_bound` may be set to `open` or `closed` to indicate whether or not to
77-
// include that endpoint of the range (by default, `left_bound` is closed and
78-
// `right_bound` is open).
85+
// Between gets all documents between two keys. Accepts three optional arguments:
86+
// index, leftBound, and rightBound. If index is set to the name of a secondary
87+
// index, between will return all documents where that index’s value is in the
88+
// specified range (it uses the primary key by default). leftBound or rightBound
89+
// may be set to open or closed to indicate whether or not to include that endpoint
90+
// of the range (by default, leftBound is closed and rightBound is open).
91+
//
92+
// You may also use the special constants r.minval and r.maxval for boundaries,
93+
// which represent “less than any index key” and “more than any index key”
94+
// respectively. For instance, if you use r.minval as the lower key, then between
95+
// will return all documents whose primary keys (or indexes) are less than the
96+
// specified upper key.
7997
func (t Term) Between(lowerKey, upperKey interface{}, optArgs ...BetweenOpts) Term {
8098
opts := map[string]interface{}{}
8199
if len(optArgs) >= 1 {
@@ -84,6 +102,7 @@ func (t Term) Between(lowerKey, upperKey interface{}, optArgs ...BetweenOpts) Te
84102
return constructMethodTerm(t, "Between", p.Term_BETWEEN, []interface{}{lowerKey, upperKey}, opts)
85103
}
86104

105+
// FilterOpts contains the optional arguments for the Filter term
87106
type FilterOpts struct {
88107
Default interface{} `gorethink:"default,omitempty"`
89108
}
@@ -92,7 +111,7 @@ func (o *FilterOpts) toMap() map[string]interface{} {
92111
return optArgsToMap(o)
93112
}
94113

95-
// Get all the documents for which the given predicate is true.
114+
// Filter gets all the documents for which the given predicate is true.
96115
//
97116
// Filter can be called on a sequence, selection, or a field containing an array
98117
// of elements. The return type is the same as the type on which the function was

0 commit comments

Comments
 (0)