From 759c035eaeab76ca5537e1cf78de19b7fc784cc3 Mon Sep 17 00:00:00 2001 From: timerzz Date: Mon, 26 Aug 2024 15:13:13 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E6=B7=BB=E5=8A=A0PageListQuery=E6=9E=84?= =?UTF-8?q?=E9=80=A0=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- structs/storage/scope.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/structs/storage/scope.go b/structs/storage/scope.go index c9575cb..ddd6f6c 100644 --- a/structs/storage/scope.go +++ b/structs/storage/scope.go @@ -27,6 +27,25 @@ type PageListQuery struct { PageQuery } +func NewPageListQuery(scoper Scoper) *PageListQuery { + return &PageListQuery{Scoper: scoper} +} + +func (p *PageListQuery) SetPage(page int) *PageListQuery { + p.Page = page + return p +} + +func (p *PageListQuery) SetPageSize(pageSize int) *PageListQuery { + p.Size = pageSize + return p +} + +func (p *PageListQuery) SetScoper(scoper Scoper) *PageListQuery { + p.Scoper = scoper + return p +} + func (p *PageListQuery) Scope(db *gorm.DB) *gorm.DB { if p.Scoper != nil { db = p.Scoper.Scope(db)