Przeglądaj źródła

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

xormplus 10 lat temu
rodzic
commit
e117fb424b
1 zmienionych plików z 6 dodań i 0 usunięć
  1. 6 0
      session.go

+ 6 - 0
session.go

@@ -237,6 +237,12 @@ func (session *Session) Limit(limit int, start ...int) *Session {
 	return 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
 // Method OrderBy provide order by query condition, the input parameter is the content
 // after order by on a sql statement.
 // after order by on a sql statement.
 func (session *Session) OrderBy(order string) *Session {
 func (session *Session) OrderBy(order string) *Session {