-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
78 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package c | ||
|
||
// Join defines join information in query. | ||
type Join struct { | ||
Mode string | ||
Collection string | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,33 @@ | ||
package c | ||
|
||
// Order defines order information of query. | ||
type Order struct { | ||
Field I | ||
Order int | ||
} | ||
|
||
// Asc orders field with ascending order. | ||
func Asc(field I) Order { | ||
return Order{ | ||
Field: field, | ||
Order: 1, | ||
} | ||
} | ||
|
||
// Desc orders field with descending order. | ||
func Desc(field I) Order { | ||
return Order{ | ||
Field: field, | ||
Order: -1, | ||
} | ||
} | ||
|
||
// Asc returns true if order is ascending. | ||
func (order Order) Asc() bool { | ||
return order.Order >= 0 | ||
} | ||
|
||
// Desc returns true if order is descending. | ||
func (order Order) Desc() bool { | ||
return order.Order < 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.