Skip to content

Commit f715c75

Browse files
author
timsolov
committed
fix comments
1 parent a77d600 commit f715c75

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

main.go

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func (q *Query) Select() string {
123123
}
124124

125125
// SELECT returns word SELECT with fields from Filter "fields" separated by comma (",") from URL-Query
126-
// or word SELECT with star ("*") if nothing provided'
126+
// or word SELECT with star ("*") if nothing provided
127127
//
128128
// Return examples:
129129
//
@@ -138,28 +138,32 @@ func (q *Query) SELECT() string {
138138
return fmt.Sprintf("SELECT %s", q.FieldsString())
139139
}
140140

141-
// HaveField returns true if request asks for field
141+
// HaveField returns true if request asks for specified field
142142
func (q *Query) HaveField(field string) bool {
143143
return stringInSlice(field, q.Fields)
144144
}
145145

146-
// AddField returns true if request asks for field
146+
// AddField adds field to SELECT statement
147147
func (q *Query) AddField(field string) *Query {
148148
q.Fields = append(q.Fields, field)
149149
return q
150150
}
151151

152-
// OFFSET returns OFFSET statement
153-
// return example: `OFFSET 0`
152+
// OFFSET returns word OFFSET with number
153+
//
154+
// Return example: ` OFFSET 0`
155+
//
154156
func (q *Query) OFFSET() string {
155157
if q.Offset > 0 {
156158
return fmt.Sprintf(" OFFSET %d", q.Offset)
157159
}
158160
return ""
159161
}
160162

161-
// LIMIT returns LIMIT statement
162-
// return example: `LIMIT 100`
163+
// LIMIT returns word LIMIT with number
164+
//
165+
// Return example: ` LIMIT 100`
166+
//
163167
func (q *Query) LIMIT() string {
164168
if q.Limit > 0 {
165169
return fmt.Sprintf(" LIMIT %d", q.Limit)
@@ -191,17 +195,18 @@ func (q *Query) Order() string {
191195
return s
192196
}
193197

194-
// ORDER returns ORDER BY statement with list of elements for sorting
195-
// you can use +/- prefix to specify direction of sorting (+ is default)
196-
// return example: `ORDER BY id DESC, email`
198+
// ORDER returns words ORDER BY with list of elements for sorting
199+
// you can use +/- prefix to specify direction of sorting (+ is default, apsent is +)
200+
//
201+
// Return example: ` ORDER BY id DESC, email`
197202
func (q *Query) ORDER() string {
198203
if len(q.Sorts) == 0 {
199204
return ""
200205
}
201206
return fmt.Sprintf(" ORDER BY %s", q.Order())
202207
}
203208

204-
// HaveSortBy returns true if request contains some sorting
209+
// HaveSortBy returns true if request contains sorting by specified in by field name
205210
func (q *Query) HaveSortBy(by string) bool {
206211

207212
for _, v := range q.Sorts {
@@ -213,7 +218,7 @@ func (q *Query) HaveSortBy(by string) bool {
213218
return false
214219
}
215220

216-
// AddSortBy adds an order rule to Query
221+
// AddSortBy adds an ordering rule to Query
217222
func (q *Query) AddSortBy(by string, desc bool) *Query {
218223
q.Sorts = append(q.Sorts, Sort{
219224
By: by,
@@ -277,8 +282,8 @@ func (q *Query) AddValidation(NameAndTags string, v ValidationFunc) *Query {
277282
}
278283

279284
// RemoveValidation remove a validation from Query
280-
// You can provide full name of filer with tags or only name of filter:
281-
// RemoveValidation("id:int") and RemoveValidation("id") are same
285+
// You can provide full name of filter with tags or only name of filter:
286+
// RemoveValidation("id:int") and RemoveValidation("id") are equal
282287
func (q *Query) RemoveValidation(NameAndOrTags string) error {
283288
for k := range q.validations {
284289
if k == NameAndOrTags {
@@ -386,7 +391,9 @@ func (q *Query) Where() string {
386391
}
387392

388393
// WHERE returns list of filters for WHERE SQL statement with `WHERE` word
389-
// return example: `WHERE id > 0 AND email LIKE 'some@email.com'`
394+
//
395+
// Return example: ` WHERE id > 0 AND email LIKE 'some@email.com'`
396+
//
390397
func (q *Query) WHERE() string {
391398

392399
if len(q.Filters) == 0 {

0 commit comments

Comments
 (0)