migrate from github

This commit is contained in:
2026-07-15 22:42:31 +08:00
commit 3ad559f05e
262 changed files with 21637 additions and 0 deletions
@@ -0,0 +1,31 @@
package template_repo
import (
"github.com/XingfenD/yoresee_doc/internal/model"
"gorm.io/gorm"
)
type TemplateCreateOperation struct {
repo *TemplateRepository
template *model.Template
tx *gorm.DB
}
func (r *TemplateRepository) Create(template *model.Template) *TemplateCreateOperation {
return &TemplateCreateOperation{
repo: r,
template: template,
}
}
func (op *TemplateCreateOperation) WithTx(tx *gorm.DB) *TemplateCreateOperation {
op.tx = tx
return op
}
func (op *TemplateCreateOperation) Exec() error {
if op.tx != nil {
return op.tx.Create(op.template).Error
}
return op.repo.db.Create(op.template).Error
}