Browse Source

增加Top方法,之前在Statement中提供了此方法,但Session中未提供

xormplus 10 years ago
parent
commit
e117fb424b
1 changed files with 6 additions and 0 deletions
  1. 6 0
      session.go

+ 6 - 0
session.go

@@ -237,6 +237,12 @@ func (session *Session) Limit(limit int, start ...int) *Session {
 	return session
 }
 
+// Method Limit provide limit and offset query condition
+func (session *Session) Top(limit int) *Session {
+	session.Statement.Top(limit)
+	return session
+}
+
 // Method OrderBy provide order by query condition, the input parameter is the content
 // after order by on a sql statement.
 func (session *Session) OrderBy(order string) *Session {