mirror of
https://github.com/usual2970/certimate.git
synced 2025-08-11 20:01:45 +00:00
.github
.vscode
docker
internal
applicant
certificate
deployer
domain
domains
notify
pkg
repository
access.go
acme_account.go
certificate.go
setting.go
statistics.go
workflow.go
workflow_output.go
rest
routes
scheduler
statistics
utils
workflow
migrations
ui
.dockerignore
.editorconfig
.gitignore
.goreleaser.yml
CHANGELOG.md
CONTRIBUTING.md
CONTRIBUTING_EN.md
Dockerfile
LICENSE.md
Makefile
README.md
README_EN.md
go.mod
go.sum
main.go
nixpacks.toml
usage.gif
25 lines
623 B
Go
25 lines
623 B
Go
package repository
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/usual2970/certimate/internal/domain"
|
|
"github.com/usual2970/certimate/internal/utils/app"
|
|
)
|
|
|
|
type CertificateRepository struct{}
|
|
|
|
func NewCertificateRepository() *CertificateRepository {
|
|
return &CertificateRepository{}
|
|
}
|
|
|
|
func (c *CertificateRepository) GetExpireSoon(ctx context.Context) ([]domain.Certificate, error) {
|
|
rs := []domain.Certificate{}
|
|
if err := app.GetApp().Dao().DB().
|
|
NewQuery("select * from certificate where expireAt > datetime('now') and expireAt < datetime('now', '+20 days')").
|
|
All(&rs); err != nil {
|
|
return nil, err
|
|
}
|
|
return rs, nil
|
|
}
|