add initial application structure with configuration, logging, and health check endpoints

This commit is contained in:
kever
2026-01-15 22:11:33 +08:00
parent ed8c3d55b8
commit fe67f09e72
19 changed files with 333 additions and 318 deletions

View File

@@ -1,15 +0,0 @@
package repository
import (
"epic-ent/internal/domain/vo"
)
type HealthRepository struct{}
func NewHealthRepository() *HealthRepository {
return &HealthRepository{}
}
func (r *HealthRepository) Check() vo.HealthStatus {
return vo.HealthStatus{Status: "ok"}
}

View File

@@ -35,7 +35,7 @@ func (r *HeroRepository) Create(ctx context.Context, req dto.HeroCreateRequest)
SetAttribute(valueOrEmpty(req.Attribute)).
SetRemark(valueOrEmpty(req.Remark)).
SetRawJSON(valueOrEmpty(req.RawJSON)).
SetSetContentJSON(valueOrEmpty(req.SetContentJSON))
SetContentJSONSet(valueOrEmpty(req.ContentJSONSet))
if req.CreateTime != nil {
create.SetCreateTime(*req.CreateTime)
@@ -43,8 +43,8 @@ func (r *HeroRepository) Create(ctx context.Context, req dto.HeroCreateRequest)
if req.UpdateTime != nil {
create.SetUpdateTime(*req.UpdateTime)
}
if req.SetUpdateTime != nil {
create.SetSetUpdateTime(*req.SetUpdateTime)
if req.UpdateTimeSet != nil {
create.SetUpdateTimeSet(*req.UpdateTimeSet)
}
hero, err := create.Save(ctx)
@@ -132,12 +132,12 @@ func (r *HeroRepository) Update(ctx context.Context, id int64, req dto.HeroUpdat
update.SetRawJSON(*req.RawJSON)
updated = true
}
if req.SetContentJSON != nil {
update.SetSetContentJSON(*req.SetContentJSON)
if req.ContentJSONSet != nil {
update.SetContentJSONSet(*req.ContentJSONSet)
updated = true
}
if req.SetUpdateTime != nil {
update.SetSetUpdateTime(*req.SetUpdateTime)
if req.UpdateTimeSet != nil {
update.SetUpdateTimeSet(*req.UpdateTimeSet)
updated = true
}
@@ -198,8 +198,8 @@ func toVO(hero *ent.EpicHeroInfo) vo.Hero {
Attribute: hero.Attribute,
Remark: hero.Remark,
RawJSON: hero.RawJSON,
SetContentJSON: hero.SetContentJSON,
SetUpdateTime: hero.SetUpdateTime,
ContentJSONSet: hero.ContentJSONSet,
UpdateTimeSet: hero.UpdateTimeSet,
}
}

View File

@@ -4,7 +4,6 @@ import "go.uber.org/fx"
var Module = fx.Options(
fx.Provide(
NewHealthRepository,
NewHeroRepository,
),
)