|
|
@ -14,6 +14,7 @@ type IWebsiteDomainRepo interface { |
|
|
|
WithWebsiteId(websiteId uint) DBOption |
|
|
|
WithWebsiteId(websiteId uint) DBOption |
|
|
|
WithPort(port int) DBOption |
|
|
|
WithPort(port int) DBOption |
|
|
|
WithDomain(domain string) DBOption |
|
|
|
WithDomain(domain string) DBOption |
|
|
|
|
|
|
|
WithDomainLike(domain string) DBOption |
|
|
|
Page(page, size int, opts ...DBOption) (int64, []model.WebsiteDomain, error) |
|
|
|
Page(page, size int, opts ...DBOption) (int64, []model.WebsiteDomain, error) |
|
|
|
GetFirst(opts ...DBOption) (model.WebsiteDomain, error) |
|
|
|
GetFirst(opts ...DBOption) (model.WebsiteDomain, error) |
|
|
|
GetBy(opts ...DBOption) ([]model.WebsiteDomain, error) |
|
|
|
GetBy(opts ...DBOption) ([]model.WebsiteDomain, error) |
|
|
@ -44,6 +45,11 @@ func (w WebsiteDomainRepo) WithDomain(domain string) DBOption { |
|
|
|
return db.Where("domain = ?", domain) |
|
|
|
return db.Where("domain = ?", domain) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func (w WebsiteDomainRepo) WithDomainLike(domain string) DBOption { |
|
|
|
|
|
|
|
return func(db *gorm.DB) *gorm.DB { |
|
|
|
|
|
|
|
return db.Where("domain like ?", "%"+domain+"%") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
func (w WebsiteDomainRepo) Page(page, size int, opts ...DBOption) (int64, []model.WebsiteDomain, error) { |
|
|
|
func (w WebsiteDomainRepo) Page(page, size int, opts ...DBOption) (int64, []model.WebsiteDomain, error) { |
|
|
|
var domains []model.WebsiteDomain |
|
|
|
var domains []model.WebsiteDomain |
|
|
|
db := getDb(opts...).Model(&model.WebsiteDomain{}) |
|
|
|
db := getDb(opts...).Model(&model.WebsiteDomain{}) |
|
|
|